Tutorial by Examples

NSAttributedString (and its mutable sibling NSMutableAttributedString) allows you to create strings that are complex in their appearance to the user. A common application is to use this to display a string and adding custom kerning / letter-spacing. This would be achieved as follows (where label ...
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"Your String here"]; [attributeString addAttribute:NSStrikethroughStyleAttributeName value:@2 range:NSMakeRange(0, [attributeString length])];
NSMutableDictionary *attributesDictionary = [NSMutableDictionary dictionary]; [attributesDictionary setObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName]; //[attributesDictionary setObject:[UIColor redColor] forKey:NSForegroundColorAttributeName]; NSMutableAttributedString *attri...
NSMutableAttributedString * string = [[NSMutableAttributedString alloc] initWithString:@"firstsecondthird"]; [string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,5)]; [string addAttribute:NSForegroundColorAttributeName value:[UIColor greenColo...

Page 1 of 1