开发者

iphone: reloading webview with rotation

i'm using uiwebview to display a very basic html page with just text. i want to support landscape and portrait orientations but i'm having a problem with resizing when the orientation changes. specifically, when the iphone is rotated to landscape, it zooms in on the text (i want the text size to remain the same and for it to fill the wider horizontal space). when it is rotated back to portrait, the text returns to the correct size but now it flows off the page to the right.

i think the solution is to reloa开发者_运维知识库d the page with each change in orientation. is there a way to reload the page each time the iphone is rotated?


You can call reload on the web view when the view controller receives either of these methods:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

You could try setting scalesPageToFit=NO in the web view. You have fairly fine grained control of the webview from the html. Look at the viewport and other meta tags you can use.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜