0

ウィンドウの下部にあるアプリ内にiAdバナーをロードし、アプリの残りの部分、UINavigationController、およびビューをウィンドウの上部に配置する必要があります。私は自分の数学と論理のスキルを実験して使用しようとしましたが、それらを正しく表示させることができないようです。

iAdバナーは正しい場所に表示されますが、NavigationControllerは表示されません。

//AppDelegate.h
AdViewController *adController;
UINavigationController *navController;
UIViewController *containerView;

//.m file didFinishLaunching...
//views and controllers already initialized
containerView.view.frame = [[UIScreen mainScreen]bounds];
[containerView.view addSubview self.adController.view];
[containerView.view addSubview self.navController.view];

//hard coded frame for an ADBannerView (loaded in .xib)
CGRect bannerFrame = self.adController.view.frame;

//sets the start point vertically by subtracting the 
//banner height from the total height of the screen
//in this case, 480 - 50
bannerFrame.origin.y = [[UIScreen mainScreen]bounds].size.height - bannerFrame.size.height;

self.adController.view.frame = bannerFrame;

//returns a rectangle that takes the 20 px status bar into account
//this rectangle's y origin is at 20
CGRect appFrame = [[UIScreen mainScreen]applicationFrame];

//This CGRect is assuming the applicationFrame
CGRect navFrame = appFrame;

//subtract the banner height from the navFrame height
//takes 50 px off of the height
navFrame.size.height = navFrame.size.height - bannerFrame.size.height;

self.navController.view.frame = navFrame;

iOSシミュレーター

4

1 に答える 1

0

iAd バナーにはビューコントローラーが必要です。さらに、Apple は、ios5 で独自のコンテナー ビューを記述できるようになるまで、viewcontroller は画面全体のビューを制御する必要があると述べています。

Apple のデモ iAd コード、特に AdBannerNavigation.app をチェックすることをお勧めします。

もう 1 つのオプションは、ナビゲーション コントローラーに iAd バナーを追加できる mobClix フレームワークを使用することです。

表示する広告がない場合に備えて計画していると思いますか? 広告掲載率が低い場合があるためです。

ps バナービューを追加する前に、ナビゲーション コントローラーの追加とサイズ変更を試みましたか?

于 2011-10-10T15:56:19.047 に答える