I want to ask something about iAd's.
My main view controller include ADBannerViewDelegate and shows iAd banner correctly.
But I need to show iAd in all views
so should I transfer the same banner to all my view?
Or it is better to create a new iAd banner in IB for each view?
like here:
TempsReel *tempsReel = [[TempsReel alloc]initWithNibName:#"TempsReel" withBanner:adView];
[self.navigationController pushViewController:tempsReel animated:YES];
[tempsReel release];
Thanks for your help.
A UITabBarController or UINavigationController is by default going to take up the entire screen. What I did in my last app was just leave an iAd sized gap in my xibs for the view controllers inside the tab bar controller or nav controller.
In my application delegate, I create the iAd banner view and add it directly to the tab bar or nav controller's view.
iAdView.frame = CGRectMake(...);
[tabBarController.view addSubview:iAdView];
Then it'll be there all the time, regardless of what tab you are on or what level in the nav stack you are.
An additional note... I suggest checking out https://www.adwhirl.com/ They provide an easy to use system that will allow you to include ads from many different sources including iAd. Apple only fills like 10% of ad requests, so you are missing out on revenue for the remaining 90%.
You're not supposed to be showing more than one iAd banner at a time, or an iAd banner on screen with any other ad from another agency for that matter.
For apps with UITabBarControllers or UINavigationController as their main setup, I believe the iAd guidelines give advice on what you should do to keep a single ad banner onscreen at all times.
I would look into adding iAds either UIWindow or a UIView, either at the bottom or top, and then putting the tab bar or nav controller in the remainder of the screen.
I haven't done this myself but this is where I would start. Keep in mind that you won't have a banner displayed all the time so whatever else you have onscreen needs to resize appropriately.
If you have a main view that's viewed the majority of the time, I would just put a banner view there and forget about the rest if this seems like too much work.
Hope this helps.
Related
I have a tab bar app that I want to add a banner ad to. I have read another answer about how to add the ad, but it didn't talk about where. It seems the most obvious position would be between the tab bar and my content, but it seems a little disruptive to put the ad between two parts of my interface. I could also put it at the top of the screen, but there are reasons why I don't prefer to do that.
Is there a way I can move the tab bar up to make space for the ad?
Changing the frame of a tabbar controller's view is really painful.
I once considered doing it for some reason and found Adam's answer to Subclass UITabBarController to adjust it's frame very helpful.
But keep in mind that UITabBarController is doing a lot of magic behind (like resizing itself and its view controllers' views at different times) and that it may change with future versions of the OS.
Changing the default behavior of Apple's UI components can also be ground to AppStore rejections (so far I've never seen iAd banners put below the tab bar.)
Basically I have an app that involves a navigation controller that moves between table views and scroll views. I wish to place iAds under the navigation bar but before the content of the page.
I assumed that in the mainwindow_iphone.xib I could just move down the view down from the navigation bar and have the app delegate handle the ads but apparently you cannot separate the navigational bar like this.
How would I go about implementing this? I would prefer to avoid having a separate banner load on each page.
If anyone needs anymore information from me, feel free to ask!
Thank you.
I'd like to add an iAd bannerView below a UITabBarController. Preferably, the actual Tab Bar would stay the same size, moving up and down with the banner view, and the views for each tab would be resized.
Is this possible or even allowed? If so, how would I go about doing this? Any tutorial links are appreciated.
If I had this setup, would I have resizing issues with the UINavigationControllers and their subviews?
Here is the technique I use, albeit for UINavigationController not UITabBarController. But I'm fairly certain you could make it work for a root UITabBarController.
global ADBannerView in iPhone app
While not mentioned in the SO question/answer, I do animate the ad appearing and disappearing, resizing the content view in the process. I've had no issues with this, and Apple's approved 3 apps with this code.
I have the following application:
I have 1 window. On that window I add two views. One view is the view of the UINavigationController. This is used to let the user navigate through my application. The other view has a ADBannerView on it. This view is placed on the bottom of the screen.
The user can navigate through my application without any problems and the ADBannerView keeps on the screen to show advertisements. But when the user clicks on the ADBannerView and close it again the banner is moved to the top of the screen and the UINavigationController views are not responding any more.
Anyone has any idea why this happens and how to resolve this issue?
I think this may be a bug in the iAdBanner view implementation. I had the same problem with my own app. When the banner expands to show the full ad, it changes it frame to fill the screen. Then when the ad is dismissed, it doesn't reset the full frame, meaning the ad banner is still occupying the entire screen, but only drawing in a small part of it.
Try implementing - (void)bannerViewActionDidFinish:(ADBannerView *)banner from the ADBannerViewDelegate protocol and adjusting the frame of the ad back to it's original size (usually 320 x 50).
I have raised this as a bug with Apple, but not gotten any response as yet. Feel free to duplicate it.
Greetings! I have a working iPhone app (huzzah!) that uses a MainView.xib containing a fully-stocked UITabBar with several UINavigationController objects and views at-the-ready.
I've now been asked to add a one-time registration view to this mix. This view would appear before the UITabBar at app-launch, get some info from the user, register with a server - or check for an existing registration, then squirrel some data away in the keychain. (If the keychain already shows proof of registration, then we skip showing this particular view.)
The registration and keychain part I've got under control (thank you Erica Sadun for the latter!), but showing that initial one-time view is proving to be trickier than I expected.
I suspect I'm too close to the problem to see what's wrong. I really hope it's pilot error and doesn't require anything too Rube Goldberg!
Here's the scenario:
The app starts by loading MainView.xib, in which lies the aforementioned UITabBar controller, et. al. For the sake of argument, let's say we must show that registration view. Also, we'd like it to have a modal appearance, so it will fly in from the bottom up. Then, when we're done, we can dismiss it, call a delegate (most likely the App Delegate) and tell it to carry on with the original UITabBar.
// Normally, the Tab Bar Controller's view is added to the window ... still do this?
[window addSubview:tabBarController.view];
// We could now set up a VC like so. Mostly harmless. (I know, "mvc" is an unfortunate abbreviation in this case.)
RegistrationVC *mvc = [[RegistrationVC alloc] initWithNibName:#"RegistrationView" bundle:nil];
Note that RegistrationView.xib has a UIView inside, but no nav controller. We want to keep it decoupled so that it can be reused, say, as part of a tab bar item's nav controller (to review your registration info, for instance).
Moving on. We create a nav controller with the intent of presenting things modally:
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:mvc];
We then present our modal VC, using the tab bar controller as the basis, and release the alloc'ed bits.
[tabBarController presentModalViewController:nc animated:YES];
[nc release];
[mvc release];
First observation. Something tells me this is just plain sloppy. You can see the first tab bar item's nav bar and view appear just as the modal view swoops in. Yeccch! Moreover, trying to set the selected VC to nil beforehand has no effect:
tabBarController.selectedViewController = nil;
We really don't want/need to use the tab bar until after the modal VC is done (and we have the delegate to help let us know when that happens).
Why am I even bothering with the Tab Bar? Well, it looks like I need something to hang that modal VC's hat on, and I don't know what else there is to use.
Is this the only way? It just seems to tether the Registration VC and the Tab Bar unnecessarily, and it just smells ... wrong.
Clues welcome/appreciated!
It's hard to answer this without knowing what your Default.png shows. Assuming you're following the HIG and it displays an empty tabBarController, I'd suggest a somewhat complicated layering:
bottom view: tabBarController.view
middle view: UIImageView: Default.png
top view: registration view positioned below the bottom of the screen
On startup, if you need to show the registration view, manually animate it upward, and once the animation is done remove the UIImageView below it. When registration is complete, manually animate the registration view downward to reveal the tabBarController. If on startup you don't need the registration view, just animate the UIImageView to fade away (or just remove it).
OTOH hand, if you're not following the HIG and instead showing some kind of splash screen, things get a bit easier. Layer like this:
bottom view: tabBarController.view
top view: UIImageView: Default.png
If you need to show registration, do presentModalViewController with animated:NO and then fade out the UIImageView. If not, just fade out the UIImageView.
That's a lengthy explanation w/o pictures, hope it makes sense. The salient point is that I'm suggesting adding a UIImageView:Default.png to be the first thing that is seen when the app starts, and use that to guide your transition into registration or tabBarController as appropriate.