当我显示Interstital Ad状态栏消失并且导航栏向上移动时。导航栏下的所有内容都会向上移动。当我关闭广告时,一切都向下移动。它看起来很奇怪而且很小。
我在故事板中使用导航控制器且Show Navigation Bar
属性为。
在AppDelegate.m
文件中显示Interstital广告的代码:
[self.interstitialAd presentFromRootViewController:self.window.rootViewController];
基本上,当我出示Interstital Ad时,我需要一切都能保持不动。
答案 0 :(得分:3)
为什么不尝试以下方法:
在StoryBoard中:
OR
查看Apple的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)
}
}