I'm setting the appearance of a UITextView's text in the storyboard via the attributed string properties. However when I try to access it at runtime in order to copy the attributes object, it returns null.
NSAttributedString *atrString = self.contentTextView.attributedText;
NSLog(@"atrString = %@", atrString);
Outputs
2013-09-20 14:44:19.572 PageTest[69125:70b] atrString = (null)
I haven't worked with attributed strings before so I'm sure I'm doing something wrong, but scouring the documentation has still left me empty handed. Any assistance would be appreciated. Thanks!
Just had the same issue: can't access attributedText on TextView if it is not marked as selectable in Interface Builder (Xcode 6.1). No problem though if the same is done in code. In my case I subclass UITextview:
-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
self.selectable = NO;
}
return self;
}
So I assume something is not quite perfect with IB. Again)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With