2015-11-08 141 views
9

当我显示Interstital广告状态栏消失并导航栏向上移动时。导航栏下的所有内容都会移至。当我关闭广告时,一切都会向下移动。它看起来非常奇怪和不好。AdMob Interstital显示导航栏时移动

我在故事板中使用导航控制器,Show Navigation Bar属性。

代码来显示广告间质中AppDelegate.m文件:

[self.interstitialAd presentFromRootViewController:self.window.rootViewController]; 

基本上,我需要的一切留在原地没有当我提出间质的广告运动。

+0

尝试下面: '的UINavigationController * aNavCntrl = [[UINavigationController的页头] initWithRootViewController:self.interstitialAd]; [aNavCntrl presentFromRootViewController:self.window.rootViewController];' –

+0

@SharmaVishal,'self.interstitialAd'是'GADInterstitial'而不是'ViewController'。 'UINavigationController'也没有'presentFromRootViewController'方法。也许你想纠正你的评论? – user1561346

+0

是的,请原谅。它被认为只是:) –

回答

3

为什么不尝试以下方法:

故事板:

  1. 添加具有模糊的一个UIVisualEffectView在你现有的视图层次 (或外连的话)
  2. 装入的AdMob到另一个模糊人物上方的新视图或 以上视图内
  3. 通过在广告中加载 从您的视图控制器管理演示文稿M查看
  4. 使用自动布局动画在屏幕上显示 (可能为酥料饼)自定义视图

OR

退房苹果的UICatalog示例。他们提供了一个在导航栏上显示搜索显示控制器的示例。

import UIKit 

class SearchPresentOverNavigationBarViewController: SearchControllerBaseViewController { 
    // MARK: Properties 

    // `searchController` is set when the search button is clicked. 
    var searchController: UISearchController! 

    // MARK: Actions 

    @IBAction func searchButtonClicked(button: UIBarButtonItem) { 
     // Create the search results view controller and use it for the UISearchController. 
     let searchResultsController = storyboard!.instantiateViewControllerWithIdentifier(SearchResultsViewController.StoryboardConstants.identifier) as SearchResultsViewController 

     // Create the search controller and make it perform the results updating. 
     searchController = UISearchController(searchResultsController: searchResultsController) 
     searchController.searchResultsUpdater = searchResultsController 
     searchController.hidesNavigationBarDuringPresentation = false 

     // Present the view controller. 
     presentViewController(searchController, animated: true, completion: nil) 
    } 
}