测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2014年12月 |
由 James Paolantonio 维护。
创建 NSString 和 NSAttributedStrings 的 DSL
使用 CocoaPods 安装
pod 'JPAttributedStringBuilder'
您是否曾经需要附加多个 NSAttributedStrings
?
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];
[text appendAttributedString:
[[NSAttributedString alloc] initWithString:firstName
attributes:@{
NSFontAttributeName : [UIFont boldSystemFont:12.0f],
NSForegroundColorAttributeName : [UIColor blackColor]
}]];
[text appendAttributedString:
[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", self.search.neighborhoodsString]
attributes:@{
NSFontAttributeName : [UIFont proximaNovaBoldWithSize:16.0f],
NSForegroundColorAttributeName : [UIColor ucDarkColor]
}]];
[text appendAttributedString:
[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@", self.bedPriceString]
attributes:@{
NSFontAttributeName : [UIFont proximaNovaRegularWithSize:14.0f],
NSForegroundColorAttributeName : [UIColor ucDarkColor]
}]];
项目中包含一个例子。要安装,
$ pod install
$ open ZipLocateSample.xcworkspace/
给我发送拉取请求!
James Paolantonio - @jpaolantonio
如果你使用它或在某处需要改变什么,告诉我吧!! :)