2015-11-08 147 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) 
    } 
}