Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle a nil font being set for TUITextView

  • Loading branch information...
commit 7f3832270d18118df454c963b7e997b95ef86a6d 1 parent c9b7cfc
Justin Spahr-Summers authored
Showing with 11 additions and 10 deletions.
  1. +11 −10 lib/UIKit/TUITextView.m
View
21 lib/UIKit/TUITextView.m
@@ -88,16 +88,17 @@ - (void)dealloc {
- (void)_updateDefaultAttributes
{
- renderer.defaultAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
- self.font, kCTFontAttributeName,
- [self.textColor CGColor], kCTForegroundColorAttributeName,
- ABNSParagraphStyleForTextAlignment(textAlignment), NSParagraphStyleAttributeName,
- nil];
- renderer.markedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
- self.font, kCTFontAttributeName,
- [self.textColor CGColor], kCTForegroundColorAttributeName,
- ABNSParagraphStyleForTextAlignment(textAlignment), NSParagraphStyleAttributeName,
- nil];
+ NSMutableDictionary *attributes = [@{
+ (__bridge id)kCTForegroundColorAttributeName : (__bridge id)self.textColor.CGColor,
+ NSParagraphStyleAttributeName : ABNSParagraphStyleForTextAlignment(textAlignment)
+ } mutableCopy];
+
+ if (self.font != nil) {
+ [attributes setObject:self.font forKey:(__bridge id)kCTFontAttributeName];
+ }
+
+ renderer.defaultAttributes = attributes;
+ renderer.markedAttributes = attributes;
}
- (Class)textEditorClass
Please sign in to comment.
Something went wrong with that request. Please try again.