Objective c AdMob integration取消对Hello World标签文本的排序

Objective c AdMob integration取消对Hello World标签文本的排序,objective-c,admob,cocos2d-x,cocos2d-x-3.0,Objective C,Admob,Cocos2d X,Cocos2d X 3.0,我已经为cocos2d-x3.2创建了一个简单的helloworld项目。添加AdMob横幅。添加横幅的本质是创建一个视图,然后首先向该视图中添加cocos2d-x内容,然后再添加横幅内容: UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [self addChildViewController:_contentController]; [contentView addSub

我已经为cocos2d-x3.2创建了一个简单的helloworld项目。添加AdMob横幅。添加横幅的本质是创建一个视图,然后首先向该视图中添加cocos2d-x内容,然后再添加横幅内容:

UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self addChildViewController:_contentController];
[contentView addSubview:_contentController.view];
[_contentController didMoveToParentViewController:self];
[contentView addSubview:_bannerView];
self.view = contentView;
结果是,在iPhone、iPhone视网膜、iPad视网膜上,而不是在iPad上,Hello World文本被扭曲如下:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
    window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];

    // Init the CCEAGLView
    CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
                                     pixelFormat: kEAGLColorFormatRGBA8
                                     depthFormat: GL_DEPTH24_STENCIL8_OES
                              preserveBackbuffer: NO
                                      sharegroup: nil
                                   multiSampling: NO
                                 numberOfSamples: 0];

    // Use RootViewController manage CCEAGLView 
    _viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
    _viewController.wantsFullScreenLayout = YES;
    _viewController.view = eaglView;

    _bannerViewController = [[BannerViewController alloc] initWithContentViewController:_viewController];

    // Set RootViewController to window
    if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
    {
        // warning: addSubView doesn't work on iOS6
        [window addSubview: _bannerViewController.view];
        //[window addSubview: _viewController.view];
    }
    else
    {
        // use this method on ios6
        [window setRootViewController:_bannerViewController];
        // [window setRootViewController:_viewController];
    }

    [window makeKeyAndVisible];

    [[UIApplication sharedApplication] setStatusBarHidden:true];

    // IMPORTANT: Setting the GLView should be done after creating the RootViewController
    cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
    cocos2d::Director::getInstance()->setOpenGLView(glview);

    cocos2d::Application::getInstance()->run();

    return YES;
}
同时,统计信息文本不会失真:

我不明白发生了什么,为什么。这是我的全部代码:

.hfile

我在AppController.mm中使用它,如下所示:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
    window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];

    // Init the CCEAGLView
    CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
                                     pixelFormat: kEAGLColorFormatRGBA8
                                     depthFormat: GL_DEPTH24_STENCIL8_OES
                              preserveBackbuffer: NO
                                      sharegroup: nil
                                   multiSampling: NO
                                 numberOfSamples: 0];

    // Use RootViewController manage CCEAGLView 
    _viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
    _viewController.wantsFullScreenLayout = YES;
    _viewController.view = eaglView;

    _bannerViewController = [[BannerViewController alloc] initWithContentViewController:_viewController];

    // Set RootViewController to window
    if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
    {
        // warning: addSubView doesn't work on iOS6
        [window addSubview: _bannerViewController.view];
        //[window addSubview: _viewController.view];
    }
    else
    {
        // use this method on ios6
        [window setRootViewController:_bannerViewController];
        // [window setRootViewController:_viewController];
    }

    [window makeKeyAndVisible];

    [[UIApplication sharedApplication] setStatusBarHidden:true];

    // IMPORTANT: Setting the GLView should be done after creating the RootViewController
    cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
    cocos2d::Director::getInstance()->setOpenGLView(glview);

    cocos2d::Application::getInstance()->run();

    return YES;
}

这里怎么了?

我发现了问题。我发现有一段时间(以小时为单位)是用黑色书写的,如图中所示,它出现在Hello World标签上,因此会扭曲:

时间显示在模拟器状态栏中。为了隐藏它,我添加了以下内容:

//fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
    return YES;
}
进入BannerViewController类,就这样

//fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
    return YES;
}