WeightedWordCloud 0.2.1

WeightedWordCloud 0.2.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布日期最后一次发布2015年5月

Maciej Swic 维护。




适用于任何 Objective-C 项目,包括今天的小部件和 Apple Watch (WatchKit) 应用程序扩展。

alt text

与 WatchKit 的示例用法

导入头文件

#import <WeightedWordCloud/HITWeightedWordCloud.h>

创建并配置一个 HITWeightedWordCloud 对象。您可以在 (void)awakeWithContext:(id)context 中完成此操作。

self.wordCloud = [HITWeightedWordCloud.alloc initWithSize:CGSizeMake(CGRectGetWidth(self.contentFrame), CGRectGetHeight(self.contentFrame)];
self.wordCloud.textColor = UIColor.whiteColor;
self.wordCloud.scale = WKInterfaceDevice.currentDevice.screenScale;

设置数据并渲染词云。字典键是您的单词,值是权重。权重控制渲染云中单词的字体大小。

NSDictionary *wordsDictionary = @{@"Very important": @500,
                                  @"Still important": @400,
                                  @"Less important": @100,
                                  @"Not important at all": @0};
[self.imageView setImage:[self.wordCloud imageWithWords:wordsDictionary]];

查看头文件了解更多选项。

要求

  • Xcode 6.3.1
  • ARC

安装

WeightedWordCloud 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中

pod 'WeightedWordCloud', '0.1.0'

作者:

Maciej Swic, [email protected]

许可证:

WeightedWordCloud 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。