简体   繁体   中英

Change Adwhirl ad orientation from portrait to landscape

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 ?

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];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM