A quick tutorial teaching you how to implement iAds into your app the proper way so it doesn't get rejected.
Main code used
In .h:
//Don't forget to add the iAd framework.
#import "iAd/iAd.h"
//Replace the " " with the left & right carrots.
@interface Test_iAdViewController : UIViewController "ADBannerViewDelegate" {
//Replace the " " with the left & right carrots.
ADBannerView *aBanner;
}
@property (nonatomic, retain) IBOutlet ADBannerView *aBanner;
@property (nonatomic, assign) BOOL bannerIsVisible;
In the .m:
@synthesize aBanner,bannerIsVisible;
(void)dealloc
{
[aBanner release];
[super dealloc];
}
//Show banner if can load ad.
-(void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
//Hide banner if can't load ad.
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
Twitter: / failcakeapps
Apple Developer Center: http://developer.apple.com/devcenter/...
Website: http://failcake.webs.com/
Channel: / milmersxcode