1

I am implementing adwhirl ad system in my game . My game is in portrait mode but i want the ad to be in landscape mode . Adwhirl developer documentation says :

6.2 Device Orientation Some ad networks including iAd will vary their ad dimensions with device orientation. If your app supports rotation you must forward orientation changes to AdWhirlView by invoking AdWhirlView.rotateToOrientation: within your UIViewController’s should/willAutorotateToInterfaceOrientation: implementation and then refit as per 6.1. If your app’s notion of orientation somehow differs from UIDevice.orientation you must also implement AdWhirlDelegate.adWhirlCurrentOrientation to return the appropriate value.

I had implementated

- (UIDeviceOrientation)adWhirlCurrentOrientation { return UIDeviceOrientationLandscapeRight; }

method but ad still comes in portrait mode ...Any idea where m getting things wrong .. or any other posible way to do so ?

Tornado
  • 1,069
  • 12
  • 28

1 Answers1

0

i've never used it, but i guess they don't mean you should implement the method adWhirlCurrentOrientation in you UIViewController... probably the are asking you to CALL that method which is already in adwhirl class, and you should call it "within your UIViewController’s should/willAutorotateToInterfaceOrientation:"

something like this:

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    [yourAdwInstance rotateToOrientation:toInterfaceOrientation];
}
meronix
  • 6,175
  • 1
  • 23
  • 36
  • I m using UIView instead of UIviewController in my game... i manually called [adView rotateToOrientation:UIInterfaceOrientationLandscapeRight]; but it doesnt work ..then i checked in its defination there i found (currAdapter =nil ) so it always return before setting the orientation .. any idea where m doing wrong – Tornado Feb 04 '12 at 09:43
  • The basic Structure is AppDelegate->UIViewController->UIView . In UIView all the gameplay and ad implementation.... – Tornado Feb 04 '12 at 09:49
  • isn't your UIView loaded in a UIViewController? Yu may have somewhere in the chain a UIViewController (or appDelegate) responsible or rotation... – meronix Feb 04 '12 at 13:54
  • Yes I have a uiviewcontroller but I had implemented the ad code in my uiview hence can't do so... Do I have to move whole ad code to uiviewcontroller .? Will it work with my present structure ? – Tornado Feb 05 '12 at 16:59
  • it's not necessary to move it to your viewController: you controller has the willRotateToInterfaceOrientation method and surely the address of the instance of your UIView that load the yourAdwInstance... so just call a method from Controller to UIView and pass it the new orientation, and from that call the adWhirlCurrentOrientation protocol method to your yourAdwInstance – meronix Feb 05 '12 at 19:39
  • its not working man.. i found something unusual i checked my app orientation its landscape left but the adwhirl ad m receiving is in portrait mode... In my view controller m returning landscape left orientation too... – Tornado Feb 06 '12 at 05:50