ios UITextView not displaying correctly (bug?)

陌路散爱 提交于 2019-12-12 01:44:53

问题


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:


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.



来源:https://stackoverflow.com/questions/10211133/ios-uitextview-not-displaying-correctly-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!