Game Development Community

dev|Pro Game Development Curriculum

Implement iAd IOS to Torque2D

by Nora Ky · 10/08/2014 (7:40 pm) · 0 comments

1- Add iAd Framework to your project

If you are using XCode 4.6, Click on your project in the Project Navigator on the left side. In General go to "Linked Frameworks and Libraries". Click on the + button and search for iAd-Framework

2- Open file T2DViewController.mm and below method viewDidLoad add method

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
    CGRect adFrame = adView.frame;
    adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
    adView.frame = adFrame;
    [self.view addSubview:adView];
}

if you want this at the top just comment out 3 line of codes

// CGRect adFrame = adView.frame;
    // adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
    // adView.frame = adFrame;