I had an interesting problem with UITextView . I use this code to place a text view on the screen in the loadView controller:
self.textView = [[UITextView alloc] init]; if (self.tutorialPage.text.length > 0) { self.textView.backgroundColor = [UIColor clearColor]; self.textView.editable = NO; self.textView.text = self.tutorialPage.text; self.textView.showsVerticalScrollIndicator = NO; self.textView.textColor = [UIColor whiteColor]; self.textView.textAlignment = NSTextAlignmentLeft; self.textView.translatesAutoresizingMaskIntoConstraints = NO;
Each line of this code causes, by the way, a textual representation, of course, on the screen. But for some reason, when the same code is called again to create another controller of the same type, the text is not displayed. However, when I select text in text form by pressing and holding, the text suddenly appears.
Even weirder when I change this line
UIFont *font = [UIFont fontWithName:@"Noteworthy-Bold" size:(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 20.0 : 15.0)];
to use a different font name, for example @"Noteworthy-Light" or @"TimesNewRomanPS-BoldMT" , the text view behaves as expected ... What could be causing this problem?
Has anyone ever seen this problem before? If yes, please share how you solved it or worked.
source share