0

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

.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];
}

所以,有两个问题:1.当应用程序运行时,iAd没有显示在正确的位置(应为0,40,0,0)但除非我将位置更改为( 0,180,0,0),但实际上不在 0,180 上。它看起来像在 0,40。

  1. 当我移动到第二个视图(PlayGameView),然后点击iAd,iAd显示全屏视图,然后我关闭iAd,PlayGameView的屏幕消失了!它被rootView取代!!如何使用 PlayGameView 停留关闭 iAd?

当点击并关闭 iAd 时,我在 rootView 上没有看到问题。任何可以提供帮助的人都将受到高度赞赏!

乔治

4

1 回答 1

0

ok, now I have finally found the problem, I replaced this

[self presentModalViewController:playGameView animated:NO];

from

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

then it work perfectlly.

now there is only one remain issue: position of iAd banner view

于 2013-03-29T08:20:46.023 回答