1

I added an ADBannerView to my app. When rotated screen to landscape i change ADBannerView to horizontal frame like this: enter image description here

But when it be clicked in iOS6, iad will open in a strange position: enter image description here

in iOS4/5 don't have this problem.

Why and how to fix? I uploaded my code to https://github.com/OpenFibers/GPSAlarm

Special thanks!

OpenThread
  • 2,086
  • 3
  • 28
  • 49
  • This is Happening because due to the orientation issue , actually in IOS6 we need to Adjust the Orientation in different way as we did in prior to iOS6(in iOS5).so i would suggest you should manage your view as device orientation gets changed,can follow this link http://stackoverflow.com/questions/13023936/orientation-issue-in-ios-6/13024015#13024015 – Kamar Shad Nov 12 '12 at 07:31
  • 1
    is your App Support multiple orientation...!!!!! – Kamar Shad Nov 12 '12 at 07:38

2 Answers2

2

As in The iOS6 Apple Has CHanged The Way of managing the Orientation of device. in iOS6 you should use new method to manage the orientation introduce in iOS6.The reason behind the problem is in your Code WillAnimate might not called whenever the device rotate.

SO you should use below Methods introduced in iOS6 release.

  - (BOOL)shouldAutorotate
  {
    return  YES;
   }

 - (NSUInteger)supportedInterfaceOrientations
  {
   return  UIInterfaceOrientationMaskAll;
  }

If you want your whole app to rotate then you should set your Info.plist to support all orientations.In your case you are supporting the whole orientation then you may allow by editing the .Plist file of APp AS I AM DOING IN BELOW SNAPSHOT.

enter image description here

Now if you want a specific view to be changed desired orientation only you will have to do some sort of subclass and override the autorotation methods to return desired orientation only.

here is the Example how to do same..

And For more Information you should take a view of this.

here it is..!!!

EDIT: As you explained clickinng the iAD in landscape mode then suddenly awkward thing happen to the ads screen. because Apple's test ads on iPhone and iPad are portrait only. Real advertisements probably will support landscape mode. Here are too many thread related to same problem.So you no need to worry.

here it is..!!!.

another for same..

another important link for the same

I hope Above Solution may help You.!!!!

Community
  • 1
  • 1
Kamar Shad
  • 6,094
  • 1
  • 28
  • 54
  • I added these two methods, but the problem still exist. My view controller can auto rotate before added these two methods. Could you have a look at my code here https://github.com/openfibers/gpsalarm? Just run, rotate simulator to landscape and click the iad banner. Very grateful to you! – OpenThread Nov 12 '12 at 08:06
  • click iad banner when screen in landscape, is there any thing strange happend? – OpenThread Nov 12 '12 at 08:46
  • @OpenThread you are right clicking on iAd in ladnscape mode it behave awkwardly.view this http://stackoverflow.com/questions/3166977/iad-left-white-blank-screen-after-closed – Kamar Shad Nov 12 '12 at 09:46
  • @iOS-Developer accept edit answer, i putted your comment in it, I'll accept answer :D – OpenThread Nov 12 '12 at 12:53
  • @OpenThread ok ...!!!!, i don't know how to accept the edit answer of some. well,let me try...!!!! – Kamar Shad Nov 12 '12 at 13:05
0

In IOS 6 there has been changes in UIKIT framework in your app delegate please use these codes to set your rootviewcontroller

if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
    //  addSubView doesn't work on iOS6
    self.window.rootViewController = navigationContoller;
}
else{
    // use this mehod on ios6
    [self.window setRootViewController:navigation];
}
spider1983
  • 1,098
  • 1
  • 7
  • 14