3

I'm trying to figure out a way to make it so that my ios webview is in landscape mode while the rest of my app is in portrait. Does anyone know if this is possible?

I have a video section that I link out to vimeo. The vimeo video player is brought up in webview which is the portion I would like in landscape.

nate8684
  • 539
  • 1
  • 9
  • 27

1 Answers1

4

you must do it programatically in the shouldAutorotateToInterfaceOrientation webview.transform=CGAffineTransformMakeRotation(M_PI/2);

touti
  • 1,164
  • 6
  • 18
  • In my app delegate? Like the following? -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { return YES; } – nate8684 Apr 02 '12 at 19:38
  • yes you test if you are in landscape mode and you rotate your webview – touti Apr 02 '12 at 19:44
  • pardon my ignorance, I'm a newbie to this all. Is this how you're saying to do it: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { return YES; webview.transform=CGAffineTransformMakeRotation(M_PI/2); } – nate8684 Apr 02 '12 at 19:46
  • Hey Touti - I really need to figure this one out. Any chance you can help me out. I tried the following: (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientatio‌​n { return YES; webview.transform=CGAffineTransformMakeRotation(M_PI/2); } ... it gives me the following errors: "expected body method" and "Expected selector for object c method". Any help you can provide would be very much appreciated, thanks! – nate8684 Jun 26 '12 at 17:44
  • I tried this in my MainViewController.m and got the error: "Use of undeclared identifier 'webview'" ... thoughts on why that is? – nate8684 Jun 26 '12 at 19:19
  • you had this error because webviewis not decalred in the MainViewController...declare it or use this code in other view controller – touti Jun 27 '12 at 07:31
  • What other view controller are you talking about? Do you mean my app delegate? I tried "- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { webview.transform=CGAffineTransformMakeRotation(M_PI/2); }" in my app delegate but got the same error. – nate8684 Jun 27 '12 at 13:53