Skip to content

dse12345z/ManageAttributedString

Repository files navigation

使用責任鏈模式(Chain of Responsibility) 實作 ManageAttributedString

alt tag

Usage

append "Hello" string

NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello");

append "Hello" string, fontName HelveticaNeue, size 10

UIFont *helveticaNeue10 = [UIFont fontWithName:@"HelveticaNeue" size:10];
NSMutableAttributedString *mutableString = [NSMutableAttributedString new];
mutableString.append(@"Hello".font(helveticaNeue10));

append "Hello One" and "Hello Two"

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");

scope

// clear previous mutableString
// mutableString.clear() = mutableString setString:@"" 
mutableString.clear()
.append(@"Label2  ")
.append(@"Yooooooo  ".color([UIColor redColor]))
.append(@"Nooooooo");

alt tag

mutableString.clear()
.append(@"Label2  ")
.append(@"Yooooooo  ").color([UIColor redColor])
.append(@"Nooooooo");

alt tag

mutableString.clear()
.append(@"Label3  ")
.append(@"Yooooooo  ")
.append(@"Nooooooo")
.color([UIColor redColor]);

alt tag

About

ManageAttributedString

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published