I want to add many ADBanners in my application. What's preferred: share one banner in all view controllers, or create an ADBanner for each viewController?
it does not really matter if you want to create a ad banner for each view.
but you need to keep in mind the best practices from documentation:
Banner View Best Practices
Only create a banner view when you intend to display it to the user. Otherwise, it may cycle through ads and deplete the list of available advertising for your application.
If the user navigates from a screen of content with a banner view to a screen that does not have a banner view, and you expect them to be on that screen for a long period of time, remove the banner view from the view hierarchy, set its delegate to nil and release it before transitioning to the new screen of content. More generally, avoid keeping a banner view around when it is invisible to the user.
When your application creates a banner view, there is a delay before the view can actually display an advertisement. If you intend to use that banner view on a screen of content that is only visible to the user for a short period of time, the banner may not have enough time to download an advertisement before a user finishes interacting with that screen of content. Instead, your application should create a single banner view and use it throughout your user interface. As the user navigates around your application, your application moves the banner view onto any screen that is expected to display a banner. The iAdSuite sample demonstrates how to implement this technique.
When an ad transitions to a rich media experience, iAd consumes additional memory so that it can display an interactive ad to the user. This memory comes from your application’s available memory. Your application must scale back its activities to allow the ad to run smoothly and respond quickly to low-memory conditions by releasing large objects that can be easily recreated after the user finishes interacting with the ad.
I prefer to create a singleton class for ads and just call the same view into each view when displayed. That way you don't have to call for a new advert on each view.
I've posted singleton code for adwhirl here is it a good practice to delete the AdBannerView on viewWillDisappear and add it back on viewWillAppear? which you should be able to ammend for just iAd
Related
I'm near completion with an app and I'm starting to add ad's to it. For adMob I have the following code in my viewdidLoad method:
bannerAd.adUnitID = "...."
bannerAd.rootViewController = self
bannerAd.load(GADRequest())
This is currently only on the first view controller that pops up. The ad is on the bottom of a landscape only app. My question is is okay to add this to all of my view Controllers that you can segue too?
I'm not exactly sure if I need to close out the ad when I leave view controllers, or if this is handled automatically. It would be simple for me to add this to all view controllers, but I'm not sure if this creates more ad requests as the user switches from view to view, or how it works...
I'm new to app development and am getting ready to roll out my first app. I would appreciate any help and I thank you in advance!!!!
In our app, Admob's Ads are displayed on several View Controllers (VCs). And each VC loads it own ad. This leads to unnecessary network usage for the user.
To counter this, can we achieve something like... loading the ad when App Launches & mirroring it on VCs... this way it could have at least two benefits:
user network would be efficiently used
there would be no delay in displaying ad when user switches views
Thanks
You wouldn't mirror the content, you could just pass the UIView between the UIViewControllers.
Put the admob code somewhere common (perhaps your app delegate) so it's only in one place. When you show a new uiviewcontroller, in it's viewWillAppear view ask the app delegate for the advert view.
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.
I have an app with a tab bar that has a few tabs with user-generated content. When each view controller loads, the viewDidLoad method makes HTTP requests to a server to fetch data, then populates its view correspondingly. Once all the data is loaded, however, the view remains the same (unless the view controller is unloaded and reloaded).
A lot of other apps with user-generated content has a similar behavior, except each view will reload if the app goes into the background then comes back into the foreground again. That is, as the user switches between the various tabs while the app is active, the content won't be automatically refreshed. If the user "quits" the app then comes back to it later, the views will be reloaded.
Are there standard practices for designing an app to behave this way? Specifically, I'm wondering if there are UIKit niceties that I can take advantage of to refresh my views on app "restarts".
Otherwise, I guess a straightforward approach is to have each view controller register for notifications in viewDidLoad and listen for the app entering the foreground. The controller can then respond to each notification by reloading its data.
In each of the View Controllers, you want to subscribe to the UIApplicationDidBecomeActiveNotification notification, and implement a method that gets called when it receives that notification. This method will do the reloading however your data needs to be reloaded is really beyond the scope of what we can answer here. This is how I do it, and how I recommend doing it.
I have looked at the PageControl example from Apple and have an architectural requirement difference. In the example the scroll view and page control objects are at the app delegate level. This means the scroll view and page control appears on every view of the application.
However, I have a "settings" view toggled from an info button (for now) that should not have these controls displayed. Therefore, I need to move my scroll view, page control, and view controllers objects down a layer and I'm struggling with how to best do this.
For example, the primary application view consists of metals (periodic elements). From this view I need a scroll view, page control, and info button on every view descending from here. Each metal will have it's own subclass where different images, calculations, etc will be displayed but I believe I need each of these subclassed elements to share the same scroll view, page control, and viewControllers array, right? Do I need a singleton?
What you are describing is kind of like how the native Weather application works. Each time you swipe, the info light is rendered as part of the page you are viewing. However, no matter what info light you tap, when it flips over you still get the same settings. Obviously this is how Apple thinks the UI should work because they did it that way. There is no reason you can't do the same.
In this situation, you don't need to create a singleton, you can use [UIApplication sharedApplication] as your singleton to get to your custom application delegate via the delegate property.
Look at Crème where I do exactly what you describe. The main view is scrollview+pagecontrol. Upon triggering the app into settings mode, the settings panel comes up that does not have a page control.
The solution is simply that you have a simple top-level UIViewController, and you make both the scrollview and pageview children of that viewcontroller. And for settings, you animate the modal settings dialog with a flip animation into the top-level UIViewController.