使用責任鏈模式(Chain of Responsibility) 實作 ManageAttributedString
NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello");
UIFont *helveticaNeue10 = [UIFont fontWithName:@"HelveticaNeue" size:10];
NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello".font(helveticaNeue10));
NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello One"));
mutableString.append(@"Hello Two"));
//the same below
NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello One").append(@"Hello Two");
// clear previous mutableString
// mutableString.clear() = mutableString setString:@""
mutableString.clear()
.append(@"Label2 ")
.append(@"Yooooooo ".color([UIColor redColor]))
.append(@"Nooooooo");
mutableString.clear()
.append(@"Label2 ")
.append(@"Yooooooo ").color([UIColor redColor])
.append(@"Nooooooo");
mutableString.clear()
.append(@"Label3 ")
.append(@"Yooooooo ")
.append(@"Nooooooo")
.color([UIColor redColor]);