Whenever I expand a UITextView to a size greater than 512, with code like:
textView = [[UITextView alloc] initWithFrame: CGRectMake(0, 0, 513, 1024)];
It no longer displays text ... 512 works, any size is lower than that too, but something larger than 512, and it stops displaying any text. Full code:
- (void)loadView { self.navigationItem.hidesBackButton = YES; self.view = [[UIView alloc] init]; self.view.backgroundColor = [UIColor blackColor]; RDLocalizedStrings * strings = [RDLocalizedStrings defaultLocalizedStrings]; NSString* message = [strings getStringWithKey: @"noUpdatesAvailableText"]; CGFloat messageFontSize; RDRectCreate(message); BOOL iPad = NO; #ifdef UI_USER_INTERFACE_IDIOM iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); #endif if (iPad) { RDRectWrite(message, 0, 100, 513, 200); messageFontSize = 20.0; } else { RDRectWrite(message, 0, 0, 320, 480); messageFontSize = 20.0; } textView = [[UITextView alloc] initWithFrame: messageRect]; textView.text = message; textView.backgroundColor = [UIColor redColor]; textView.textAlignment = UITextAlignmentCenter; textView.textColor = [UIColor whiteColor]; textView.font = [UIFont systemFontOfSize: messageFontSize]; textView.editable = NO; [self.view addSubview: textView]; }
ipad uitextview
Nick
source share