Hey All, I am trying to include iAds in my app. It works fine when there is network connection but the iAds doesn't hide when the network is not available..please find the code below and help me..thanks for your time..
I included this code in viewDidLoad
static NSString * const kADBannerViewClass = @"ADBannerView";
if (NSClassFromString(kADBannerViewClass) != nil) {
if (self.adView == nil) {
self.adView = [[[ADBannerView alloc] init] autorelease];
self.adView.delegate = self;
self.adView.frame = CGRectMake(0,355,320,60);
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
}
}
[self.view addSubview:self.adView];
Delegate methods:
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible) {
[UIView beginAnimations:nil context:NULL];
banner.frame = CGRectOffset(banner.frame, 0,10);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible) {
[UIView beginAnimations:nil context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -10);
[UIView commitAnimations];
self.bannerIsVisible = NO;
NSLog(@"%@",error);
}
}