ios - iAd in UITableViewController -


I have a UITableViewController that I want to add iAds. I want to show the ad all the time at the bottom of the screen. I have answered here: and have achieved this behavior. However, the ad is hidden in the beginning and only when the user scrolls the table. When the screen is loading, how can the ad not only appear at the bottom of the ad screen when the user scrolls?

To show ads when the view is visible, I add the banner view to the viewerhandpier < Previous> - (zero) viewDeadPower: (BOOL) animated {[Super Viewed Up: Animated]; _myIAD = [[AutoApplider] IIAD]; If (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPhone) {// iPhone code if ([UIApplication sharedApplication] .statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication] .statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) {if (floor (NSFoundationVersionNumber) & lt; = NSFoundationVersionNumber_iOS_6_1) {_myIAD.frame = CGRectMake (0, _myTableView.frame.size.height - 50, 320, 50); } And (_myIAD.frame = CGRectMake (0, _myTableView.frame.size.height - 114, 320, 50);}} if ([UIApplication shared Avedna]. Statsbarorianteshn == Uaianprfesorenteshnlandskep lift || [Uaipeepisishn Sajaanupryog] Statsbar Orientation == UINTERFERSEERENTION LANDSCAPE WRITE} {if (Poor (NSF Foundation warsnumber) <= NSFoundationVersionNumber_iOS_6_1} {_myIAD.frame = CGRectMake (0, _myTableView.frame .size.height - 32, 480, 32);} and (_myIAD) .frame = CGRectMake (0, _myTableView.frame.size.height - 84, 480, 32);}}} and {// ipad code if ([UIApplication shared The applicant]. Statsbar Orientation == UINFFERNCE APPLICATION PORTATES [UIApplication shared application]. Statsbar Orientation == UIFreference Orientation PortUpdreamdowndown (if (flooring (NSF Foundation warsnumber)) = l = (NSFoundationVersionNumber_iOS_6_1) {_myIAD.frame = CGRectMake (0, _myTableView. frame.size.height - 66, 768, 66);} and (_myIAD.frame = CGRectMake (0, _myTableView.frame.size.height - 130, 768, 66);}} if ([UIApplication shared Avedna ]. Statsbar Orientation ==UINTERFERSAUTIONATION LENGESEF LIFT || [UIPPCision ShareApp]. Statsbar Orientation == UINTERFACE ONLINE LIGHTWIDE RIGHT) {if (flooring (NSF FoundationWersnumber)) = l = NSFoundationVersionNumber_iOS_6_1 {_myIAD.frame = CGRectMake (0, _myTableView.frame .size.height - 66, 1024, 66); } And (_myIAD.frame = CGRectMake (0, _myTableView.frame.size.height - 130, 1024, 66);}}} [Self.view addSubview: _myIAD];}

There is a ton of code to deal with IOS6.1 and iPad and iPhone, but it works really well.

As you can see, there is a line < Pre> _myIAD = [[self appdelegate] myIAD];

I'm actually creating a banner in app reps and uses it in all view controllers. For, I register in the viewDidLoad for an alert Would cause.

  - (minus) Drishydidlod {[super Wudidlod]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (updateUI :) Name: UIDeviceOrientationDidChangeNotification object: nil];}   

And basically use the same code in the Didierpier in the method update. UI:

The only other thing was to keep this code under iAd . - (zero) ScrollVididScroll: (UIScrollView *) Scrollview {CGRect Frame = _myIAD.frame; Frame.origin.y = _myTableView.contentOffset.y + _myTableView.frame.size.height- _myIAD.frame.size.height; // scroll _myIAD.frame = look down on the frame; [_myTableView LearnScienceToFront: _myIAD]; }

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -