I've got an off-screen UITextView instance loaded from a nib which is moved into the screen frame when the user taps a "comment" button. Any text the enter uses is invisible. If the user rotates the device, the text appears.
I've tried throwing setNeedsDisplay and setNeedsLayout, as well as setting the text, textColor, and font properties after it comes on screen with no luck.
I have an example Xcode project demonstrating the bug.
Any suggestions?
I couldn't solve this problem so I wait until the view has finished animating on screen and recreate the UITextView, remove the old one, and replace it with the new one.
It's very inelegant since I even need to keep a BOOL ivar for remembering if I've already replaced the text view (or not).
so the solution is to instantiate the UITextView in your code and add it as a subview when the textview needs to appear in the screen for the first time. Then you can make it disappear and reappear and it should be OK.
UITextView *aTextView = [[UITextView alloc] initWithFrame:CGRectMake(20, 89, 684, 441)];
[aTextView setFont:[UIFont systemFontOfSize:17.0]];
[addCommentView insertSubview:aTextView atIndex:1];
[self setCommentTextView:aTextView];
[aTextView release];
It's working great for me !
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