Whenever I widen a UITextView to a size greater than 512, with code such as:
textView = [[UITextView alloc] initWithFrame: CGRectMake(0, 0, 513, 1024)];
It doesn't display any text anymore... 512 works, any size below that too, but anything greater than 512 and it stops displaying any text. The 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];
}
It seem UIViewAutoresizingFlexibleWidth
make ipad's UITextView
hide text. Resize with textView.frame=CGRectMake(0,0,768,21)
can fix this.
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