测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
Released最近发布 | 2015年2月 |
由 [email protected] 维护。
依赖项 | |
RegexKitLite | ~> 4.0 |
AFMacros | >= 0 |
NSString-HTML | >= 0 |
使用CoreTextLabel,你能够在iOS(>= 5.0)应用程序中绘制带自定义字体和颜色的NSAttributedString或HTML。同时支持numberOfLines
和truncation
(NSLineBreakByTruncatingTail)。
CoreTextLabel * label = [[CoreTextLabel alloc] initWithFrame:frame];
label.html = htmlString;
[label sizeToFit];
[self.view addSubview:label];
将CoreTextLabel pod添加到你的Podfile中。
$ vim Podfile
platform :ios, '5.0'
pod 'CoreTextLabel', :head
然后,在你的项目中安装依赖项。
$ pod install
记得在构建时始终打开Xcode工作空间而不是项目文件。
$ open App.xcworkspace
CoreTextLabel 1.0及以上需要iOS 5.0及以上。
CoreTextLabel使用ARC。
如果你在非ARC项目中使用CoreTextLabel,你需要将所有CoreTextLabel源文件的编译器标志设置为`-fobjc-arc`。
要在Xcode中设置编译器标志,请转到活动目标并选择“构建阶段”选项卡。现在选择所有CoreTextLabel源文件,按Enter键,插入`-fobjc-arc`或`-fno-objc-arc`,然后点击“完成”以启用或禁用CoreTextLabel的ARC。
CoreTextLabel由Daniel Kuhnke为appfarms GmbH & Co. KG创建。
CoreTextLabel在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。