iPad – UITEXTVIEW width is greater than 512 does not display text

Whenever I expand UITextView to a size greater than 512, the code is as follows:

textView = [[UITextView alloc ] initWithFrame: CGRectMake(0, 0, 513, 1024)];

It doesn’t display any text anymore… 512 works, any size is also lower than this, but anything greater than 512, it stops displaying any text. Complete 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;< br /> textView.backgroundColor = [UIColor redColor];
textView.textAlignment = UITextAlignmentCenter;
textView.textColor = [UIColor whiteColor];
textView.font = [UIFont systemFontOfSize: messageFontSize];
textView.editable = NO;

[self.view addSubview: textView];
}

It seems that UIViewAutoresizingFlexibleWidth makes the UITextView of the ipad hide the text. Using textView.frame = CGRectMake(0,0,768,21) to adjust the size can solve this problem.

< p>Whenever I expand UITextView to a size greater than 512, the code is as follows:

textView = [[UITextView alloc] initWithFrame: CGRectMake(0, 0, 513, 1024)];

It no longer displays any text… 512 works, any size is also lower than this, but any greater than 512, it stops displaying any text. Complete code:

- (void)loadView {
self.navigationItem.hidesBackButton = YES;

self.view = [[UIView al loc] 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;
}
< br /> textView = [[UITextView alloc] initWithFrame: messageRect];
textView.text = message;
textView.backgroundColor = [UIColor redColor];
textView.textAlignment = UITextAlignmentCenter;
textView.textColor = [UIColor whiteColor];
textVi ew.font = [UIFont systemFontOfSize: messageFontSize];
textView.editable = NO;

[self.view addSubview: textView];
}

It seems that UIViewAutoresizingFlexibleWidth makes the UITextView of the ipad hide the text. Resizing with textView.frame = CGRectMake(0,0,768,21) can solve this problem.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 961 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.