简体   繁体   English

更改UISearchController的位置-iOS Swift

[英]Changing Position of UISearchController - iOS Swift

How can I change the position of UISearchController ? 如何更改UISearchController的位置? So far, I placed it under the navigationcontroller : 到目前为止,我将其放置在navigationcontroller下:

self.tableView.tableHeaderView = controller.searchBar self.tableView.tableHeaderView = controller.searchBar

But I want to achive something like this: 但我想达到这样的目标:

http://postimg.org/image/kwv6xippl/ http://postimg.org/image/kwv6xippl/

So under navigation there is UISegmentedControl item, and next is my searchBar... 所以在导航下有UISegmentedControl项目,接下来是我的searchBar ...

This is possible to implement? 这有可能实现吗? If so , please help :) Thanks ;) 如果是这样,请帮助:)谢谢;)

Instead of creating a Table View Controller in your storyboard, you can create a View Controller and a Segmented Control, Search Bar and Table View as subviews to the View of the View Controller in that order. 代替在情节提要中创建Table View Controller,可以按顺序创建View Controller和分段控件,搜索栏和Table View作为View Controller视图的子视图。

like so... 像这样...

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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