ビュー間で共有するためにiAdを使用していますが、手がかりが見つからない解決策をインターネットで閲覧している2つの奇妙な問題があるため、ブレーンストーミングのために質問とコードをここに投稿します。
.h: @interface AppDelegate : NSObject { UIWindow *window; ADBannerView *adBanner;
appViewController *viewControllerApp;
}
.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions {
adBanner = [[ADBannerView alloc] initWithFrame:CGRectZero];
adBanner.currentContentSizeIdentifier =ADBannerContentSizeIdentifierLandscape;
adBanner.delegate = self;
adBanner.backgroundColor = [UIColor whiteColor];
adBanner.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
//----------------------------------------------------------------------------------
[window addSubview:viewControllerApp.view];
[window makeKeyAndVisible];
return YES;
}
appViewController.m
-(void)viewWillAppear:(BOOL)animated
{
//#ifdef LITE_VERSION
[SharedAdBannerView setFrame:CGRectMake(0, 40, 0, 0)];
[self.view addSubview:SharedAdBannerView];
//#ifdef
}
appViewController.m のどこかに:
{....
playGameView = [[PlayGameViewController alloc] initWithNibName:@"PlayGameViewController"
bundle:nil];
[self.view insertSubview:playGameView.view atIndex:10];
}
したがって、2 つの質問があります: 1. アプリの実行中、iAd は正しい位置 (0,40,0,0 にする必要があります) に表示されませんが、位置を ( 0,180,0,0) ですが、実際には 0,180 ではありませんでした。0,40 のように見えます。
- 2 番目のビュー (PlayGameView) に移動し、iAd をクリックすると、iAd が全画面ビューを表示し、iAd を閉じると、PlayGameView の画面が表示されなくなりました。rootView に置き換えられました!! PlayGameView のままで iAd を閉じるにはどうすればよいですか?
iAd をクリックして閉じたときに rootView で問題が発生することはありません。
BRゲオルク