开发者

UIScrollView + UITextView resizing causes textView to scroll one line

I have a UITextView with isScrollEnabled set to FALSE. I then add it as a subview of UIScrollView. I then set the content size UIScrollView based on the size of the textView. You might wonder why I am doing this. But there is a need that it be d开发者_高级运维one in this way alone. There is also a UIWebView that I add below the UITextView. I have to resize everything in textViewDidChange delegate method. Everything works fine as long as I don't rotate the view. When the device orientation changes to landscape. The first line of my UITextView scroll up and goes out of view. It never comes back on rotating over and over. My webView also behaves weirdly after rotation. It enlarges the font and messes it up. How can I avoid both these problems. Both UITextView and UIWebView are class variables that I create programmatically in viewDidLoad method of my viewController.


You should have 2 frames for each of these object and set them according to the rotation of the device.

In the device rotation delegate use an if:

- if landscape: set Landscape frames
- if portrait: set portrait frames

Hope this help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜