1

In my iPad app that supports all the device orientation, I add an adBannerView to the main view.

So far so good. It works and the ad rotates as expected.

If I click on a particular ad this is visualized full-screen, and when I close it I get back to my app.

The problem is that if you rotate the device while you are visualizing the full-screen ad, this rotates correctly, but when you close it and come back to the app the view is not rotated.

How to solve this? Please help or I will destroy my iPad! ;-)

Abramodj
  • 5,709
  • 9
  • 49
  • 75

1 Answers1

0

Basically, you want the

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

method to be called again...

To do that, when the user closes the iAd, simply execute:

UIViewController *correctOrientation = [[UIViewController alloc]init];
[self presentModalViewController:correctOrientation animated:NO];
[self dismissModalViewControllerAnimated:NO];
gtmtg
  • 3,010
  • 2
  • 22
  • 35
  • @Abramodj Is your - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation method correct? What are you returning – gtmtg Jun 08 '12 at 18:53
  • @Abramodj Provided that you put the code above in the right place, I don't know what the problem is... – gtmtg Jun 08 '12 at 18:58
  • @Abramodj I got this from Josh's answer to http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation, and it works in my app... Can you have shouldAutorotateToInterfaceOrientation log the device orientation (you can use NSLog(@"%@",interfaceOrientation) to do this)? Then you'll be able to see if it's able to recognize the device orientation correctly or not... – gtmtg Jun 08 '12 at 19:09
  • Logging I can see that shouldAutorotate is called with the correct orientation, but willRotate is not called at all, neither with your trick. By the way thank you for your help! – Abramodj Jun 08 '12 at 19:25
  • @Abramodj No problem. [This Q&A](http://developer.apple.com/library/ios/#qa/qa1688/_index.html) by Apple might help – gtmtg Jun 08 '12 at 19:36