iAd用于uiview共享



我正在使用iAd进行视图之间的共享,但是有两个奇怪的问题,我一直在互联网上浏览解决方案而没有找到线索,因此我在这里发布我的问题和代码进行头脑风暴。

. h:@interface AppDelegate: NSObject {ui窗口*窗口;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];
}

所以,有两个问题:1. App运行时,iAd未显示在正确位置(应为)0,40,0,0)但是它不会出现除非我把位置改成(0,180,0,0)但是它实际上不在0,180上。它看起来像0,40

  1. 当我移动到第二个视图(PlayGameView),然后点击iAd, iAd显示一个完整的然后我关闭iAd, PlayGameView的屏幕消失了!取而代之的是rootView ! !我如何关闭iAd与PlayGameView停留?

当iAd被点击并关闭时,我没有看到rootView的问题。任何人都可以帮忙非常感谢!

BRGeorg

好的,现在我终于找到问题了,我替换了这个

[self presentModalViewController:playGameView animated:NO];

[self.view insertSubview:playGameView.view atIndex:10];

那么它工作得很好。

现在只剩下一个问题:iAd横幅视图的位置

最新更新