ios UITextView not displaying correctly (bug?)

2019-09-05 14:39发布

I have 10 UITextViews laid out horizontally in a UIScrollView that has paging enabled.

when my view is initd and brought to view, the initial page's UITextView's text does not appear. The background color shows up fine, but the text is not visible on screen.

Here's the phenomenon:

As soon as you drag the UIScrollView even 1px the text magically displays it's self. What's the deal? How can I fix this?

** edit - code for kai **

[self.messageBodyTxt setFont:[UIFont fontWithName:@"MuseoSlab-300" size:16.67]];
[self.messageBodyTxt setText:[[data objectForKey:@"Description"] valueForKey:@"text"];

Note - I've already tried using a system font. Also, this code works on a different view so I'm not sure what'sup.

1条回答
唯我独甜
2楼-- · 2019-09-05 14:51
CGRect f = self.myTextView.frame;
f.size.height += 1;
[self.myTextView setFrame:f];

Because my UITextView is already in a XIB file I just modify the existing height by 1px and viola. As @larsacus pointed out, this is only necessary when the module's width is over 512px.

查看更多
登录 后发表回答