Game Development Community

iAds causes game to switch from portrait to landscape

by Josiah Reeves · in Torque 2D Beginner · 06/16/2014 (10:00 pm) · 0 replies

I have my game setup for portrait only but when i click on an ad and then exit out of it the game is in landscape and takes several seconds to switch back. It's possible though i'm just setting up iAds incorrectly or maybe there's some setting that is causing this that i just don't know about. Here is code I added:
In T2DViewController.h
#import <iAd/iAd.h>
@interface T2DViewController : GLKViewController <ADBannerViewDelegate> {

At end of T2DViewController.mm
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [banner setAlpha:1];
    [UIView commitAnimations];
}


-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [banner setAlpha:0];
    [UIView commitAnimations];
}

@end

And of course placed the ad bannerView in the iPhoneStoryboard.storyboard and made it a delegate of the view controller