在SplitViewController的细节中,UISearchBar放错位置

时间:2015-07-26 17:04:39

标签: ios xcode swift

我正在使用UISplitViewController,在详细视图中我有一个UISearchController,但当搜索栏激活时,组件突然向右移动,其中一半停留在屏幕外。

我试图发布图片,但遗憾的是“你需要至少10个声望来发布图片。”所以我上传了http://iferiados.com.br/bug.jpg

仅在iPad中出现且仅在显示模式为.AllVisible时,如果我将详细视图展开到所有屏幕,搜索栏将保持在正确的位置。

我的搜索控制器代码:

var searchController: UISearchController!

//and in the viewDidLoad():

    searchController = UISearchController(searchResultsController: nil)
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.dimsBackgroundDuringPresentation = false
    searchController.searchBar.placeholder = "Procure pelo nome"
    searchController.searchBar.delegate = self
    searchController.searchResultsUpdater = self
    searchController.searchBar.sizeToFit()
    tableView.tableHeaderView = searchController.searchBar

感谢。

1 个答案:

答案 0 :(得分:0)

看起来您对搜索栏没有任何必要的限制。如果您通过故事板进行配置,请确保您有所有约束或查看Apple有关约束的文档。此外,如果您说问题只发生在iPad上,请确保在故事板的底部" Any Any"被选中。

相关问题