Rupert
Rupert

Reputation: 1

Are there Rotate Webview examples around?

I thought I had already asked this question but I cant see it so I will ask again.

I need to write an app which simply contains a webview that rotates. How do I rotate the text when the user puts their phone from portrait to landscape or vice versa?

Cheers

Paul

Upvotes: 0

Views: 1357

Answers (2)

Ben Scheirman
Ben Scheirman

Reputation: 40961

This is handled automatically. In your view controller, override the method:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
    return YES;
}

And make sure your webview's autoresizing mask is set like this:

webView.autoResizingMask = UIViewAutoresizingFlexibleHeight |   UIViewAutoresizingFlexibleWidth;

Upvotes: 1

kubi
kubi

Reputation: 49354

Are you controlling the UIWebView with a UIViewController? If so, override

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

Upvotes: 0

Related Questions