0

I am making an application, that has iAd, but when I am not connected to the internet the space where the iAd is supposed to be, is a white empty space, how do I make it so the iAd space is not white, and is the same color as the background

I want to make an iAd programmatically, and then I want to hide it when not available. If you could give me some code, that will be nice.

user2167312
  • 129
  • 1
  • 2
  • 6
  • Refer to this question: http://stackoverflow.com/questions/3123259/how-do-i-hide-iad-banners-when-no-ads-are-being-served – Hejazi Mar 19 '13 at 21:11
  • 1
    hi, I will tell you something, I am just 14 years old, and love to code. I just need some help with this, can you please give me some code. – user2167312 Mar 19 '13 at 21:21
  • check the edited answer, and don't forget to checkmark my answer if it is the correct answer. – Adrian P Mar 19 '13 at 23:57

2 Answers2

3

Glad to hear that you are already developing apps at 14. Way to go man. Here is the link to apple's iad sample code. Download it and take a look at the methods. It has 3 or 4 different ways to implement the iad and has the method to respond when there is no iad download. Hope it helps and keep up the good work.

http://developer.apple.com/library/ios/ipad/#samplecode/iAdSuite/Introduction/Intro.html

gere is the code that hides the banner if there is no ad:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
    [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// Assumes the banner view is placed at the bottom of the screen.
    banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
    [UIView commitAnimations];
    self.bannerIsVisible = NO;
}
}

this is directly from the sample codes which i have given you the link in above paragraph. hope you find it useful my young programmer friend.

Adrian P
  • 6,479
  • 4
  • 38
  • 55
  • I dont want a timer on here, i need to make it so, i iad pops out from the bottom of the screen, and when not available, I dont want anything there, do you know how to do that, code is appreciated. Please help me – user2167312 Mar 19 '13 at 23:01
  • it shows an error that property bannerIsVisible is not a type of the .h file. What do I do – user2167312 Mar 20 '13 at 00:06
  • This is the method that hides the banner placement if there is no add. Try downloading the tab bar sample. That is the one that places the add on the button of the screen. The method hides the frame. For the whole .h and .m just download the samples and use them. – Adrian P Mar 20 '13 at 00:09
1

The simplest solution: If you make the background of the iAd container [UIColor clearColor] then the container will be invisible when there is no advertisement being displayed. You can do this in Interface Builder or programmatically.

dgund
  • 3,459
  • 4
  • 39
  • 64