I'd like to put a search bar in my navigation bar, like safari has. If I add a UISearchBar to my view, it ends up underneath the navigation bar instead. How can I put a search bar in (not under) a unnavigationbar?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Navigation bar disappears when typing in UISearchC
- Can not export audiofiles via “open in:” from Voic
A navigationBar is mostly used to navigate a view hierarchy. If all you need is a search bar on the top of the page, why wont you just use a regular searchBar with a background similar to the navigationBar?
That way you will have much more control on the layout of the search bar, and you won't have to deal with the navigationBar.
By the way, this is probably the way the safari app actually work - it doesn't place the searchBar inside a navigationBar. You can see this by the fact that the searchBar is scrolled and doesn't stay on top.
I do it this way:
I hope it helps!
Try putting UISearchBar or UITextField in titleView of UINavigationItem and then set this in topItem of navigation bar.
Refer to human interface guideline to confirm that it is allowed.