草庐IT

Searchbar

全部标签

swift - 快速向下滑动时的搜索栏

我正在为iOS开发社交媒体应用我的ViewControllers当前嵌入在NavigationController中。在我的新闻提要屏幕上,我需要在用户向下滑动时显示一个搜索栏(并在他向上滑动时隐藏它),如果用户在其中输入内容,搜索结果将显示在新闻提要屏幕的顶部。我曾尝试修改这个,但我是iOS的新手,到目前为止还没有成功。如有任何帮助,我们将不胜感激,请记住,我只进行了几周的iOS编程,因此深入了解会有所帮助。谢谢! 最佳答案 首先,您需要实现UISwipeGestureRecognizer在viewDidAppear中包含setu

ios - 如何让搜索栏在 uicollectionview 中工作

我想在uicollectionView上方放置一个搜索栏,如下图所示。我想以编程方式执行此操作。当前View这是我的搜索栏设置功能代码。我在主视图Controller中有它。funcsetupSearchBar(){letsearchBar=UISearchBar(frame:CGRect(x:0,y:64,width:UIScreen.main.bounds.width,height:32))searchBar.barTintColor=UIColor(red:64/255,green:64/255,blue:64/255,alpha:1)searchBar.backgroundCo

ios - 添加 UISearchController 并以编程方式使用约束定位它

我想以编程方式向UISearchController添加前导、尾随、底部和宽度约束。这是我的代码:@IBOutletweakvarnavigationBar:UIView!//createsearchbarsearchBar=UISearchController(searchResultsController:nil)navigationBar.addSubview(searchBar.searchBar)searchBar.searchBar.translatesAutoresizingMaskIntoConstraints=falseletleftConstraint=NSLayo

ios - 在 UISearchController 中隐藏搜索栏上的取消按钮

我试图在UISearchController中隐藏搜索栏的取消按钮,但不幸的是,在viewDidLoad()中设置以下内容不起作用:overridefuncviewDidLoad(){super.viewDidLoad()searchResultsTableController=UITableViewController()searchResultsTableController.tableView.delegate=selfsearchController=UISearchController(searchResultsController:searchResultsTableCon

ios - iOS 11 搜索栏平滑消失

我遇到了一个小问题,我在我的应用程序中实现了新的iOS11样式搜索栏,我注意到它消失了,并且动画与消息中的动画略有不同。它更快,更不流畅。有人遇到过这个“问题”吗?这是我使用的代码:searchController.searchResultsUpdater=selfsearchController.obscuresBackgroundDuringPresentation=falsesearchController.searchBar.delegate=selfif#available(iOS11.0,*){navigationItem.searchController=searchCo

ios - 如何在 UISearchController 中使用范围栏

我能够为UISearchController创建范围栏并设置它们的标题resultSearchController=({letcontroller=UISearchController(searchResultsController:nil)controller.searchResultsUpdater=selfcontroller.dimsBackgroundDuringPresentation=falsecontroller.searchBar.showsScopeBar=truecontroller.searchBar.scopeButtonTitles=["One","two"

ios - 搜索栏未显示在导航栏 iOS 11 上

我正在将viewController推送到我想要搜索栏的地方,但搜索栏根本没有显示。下面是代码。我错过了什么吗?varsearchController=UISearchController(searchResultsController:nil)searchController.searchResultsUpdater=selfsearchController.obscuresBackgroundDuringPresentation=falsesearchController.searchBar.placeholder="Searchhere..."definesPresentatio

ios - 如何更改导航栏中 titleView 的大小。因为在 navigationBar 的 titleView 和 backButton 之间有一个空隙

我已经在我的navigation.titleView中添加了一个搜索栏self.navigationItem.titleView=searchBar还有一个带有title=""的BackBarButtonItemself.navigationItem.backBarButtonItem?.title=""但是BackButton和SearchBar之间存在间隙,如下所示:我认为这里出现间隙是因为backBarButtonItem的title有空间(因为我的title是null""但空间仍然那里)所以我想问一下如何省略那个间隙?我想让我的searchBar更靠近我的backBarIcon

swift - 如何在范围按钮更改时更新搜索结果。 swift UISearchController

如何在范围按钮更改时更新搜索结果(在我点击范围后)?当我再次输入时,搜索结果发生了变化(具有新的范围)!searchControl-配置导入UIKitclassProductTableView:UIViewController,UITableViewDataSource,UITableViewDelegate,UISearchResultsUpdating{@IBOutletweakvartableView:UITableView!varsearchController:UISearchController!varfriendsArray=[FriendItem]()varfilter

ios - 如何更改 CNContactPickerViewController searchBar 的颜色

我从一个ViewController启动了一个CNContactPickerViewController,但我怎样才能更改其中搜索栏的文本颜色。导航栏是深蓝色的,在iOS11中默认的搜索栏文本是黑色的。 最佳答案 我更新了快速修复的方法在呈现CNContactPickerViewController之前,您应该设置UISearchBar的背景颜色UISearchBar.appearance().backgroundColor=UIColor.whiteletcancelButtonAttributes=[NSForegroundCo