Determine how text will render on the screen. You can think of NSAttributedString as an NSString where each character has an NSDictionary of “attributes”.
What is NSRange
To specify subranges inside strings and arrays. It’s a c structure defined as below:
NSNotFound
A value, or a constant that indicates that an item requested couldn’t be found or doesn’t exist.
NSRangePointer
Just a NSRange * used as an method parameter
Access attributes of NSAttributedString
get the value for an attribute
get all attributes as NSDictionary
Set attributes of NSAttributedString
Since NSAttributedString is immutable, we need NSMutableAttributedString to do all the settings…
NSAttributedString is not an NSString
It’s not a subclass of NSString, methods of NSString don’t apply for NSAttributedString. However, you can convert it to NSString using - (NSString *)string.
UITextView
Display multiline text using custom style
selectable, editable, scrollable
Set text and attributes in UITextView using textStorage
NSTextStorage is a subclass of NSMutableAttributedString.
simply modify it and the UITextView will automatically update
Set font in UITextView
one thing to keep in mind, the @property(nonatomic,strong)UIFont*font; will apply a font to the entire UITextView