简体   繁体   中英

UISearchController inside UISplitView with UINavigationController

So I'm using this project as my example of the issue I'm having: https://github.com/ioscreator/ioscreator/tree/master/IOS8SwiftAddSearchTableViewTutorial

The two changes I make are #1: make it a universal app

#2 drag a UISplitview controller into Interface Builder and set it as the root view controller with the existing UINavigationController assigned as the detail view segue

Load it on the iPad in portrait and everything is fine because it is only showing one column. If you turn it to landscape though and try again you'll see that the searchbar position is now wrong. I've seen several other related issues that mentioned setting edgesForExtendedLayout = UIRectEdge.None but that appears to be a different issue than this. Has anybody else run into this or am I doing something wrong?

Setting the constraints programmatically can be extremely difficult, it depends entirely on the layout of the current view.

Have you tried creating it in storyboard and then setting the hidden value to true on viewDidAppear() and then setting it to false when you need it?

That way you may be able to set the proper constraints using storyboard, then show it when you need it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM