uisearchbar

How do I set the UISearchController's searchBar to a view that isn't the tableHeaderView or navigationItem.titleview?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:30:38
问题 I'm trying to keep the search bar in view as the table scrolls. At the moment I'm placing it as the header in a tableview, and it works as it should, but of course the search bar scrolls off screen as you go down the table. I thought I could do this simply modifying this code sample: How do I use UISearchController in iOS 8 where the UISearchBar is in my navigation bar and has scope buttons? searchController = UISearchController(searchResultsController: nil) searchController

UISearchBar with hidden UINavigationBar

…衆ロ難τιáo~ 提交于 2019-12-10 12:24:37
问题 I have the search bar in the top of the table and the hidden navigation bar. Along with UISearchBar I use UISearchDisplayController . UISearchDisplayController has the possibility to bring forward the navigation bar. So, when I tap the cancel button in the search bar, the navigation bar fly's down. How can I dismiss this possibility, so the navigation bar will always be hidden? Thanks 回答1: One solution is to make the search bar the table header view in which case it will scroll with the table

How to send the details of a selected cell to another view controller

。_饼干妹妹 提交于 2019-12-10 11:54:52
问题 I have an sqlite3 database that is loaded inside a tableview. I have also a search feature that is working correctly. I want whenever i select a cell, i will be redirected to the view controller "Details", and printing inside it the details concerning the item selected. I have tried to trace the selected item with indexpath.row, but whenever i perform a search, normally, the indexpath.row will automatically change. So therefore i am stuck , how to pass a unique variable from the selected row

How to have a searchbar which shows suggestions with different uitableview

一笑奈何 提交于 2019-12-10 10:52:02
问题 I want to have a search bar at navigation bar and when the user start typing, show some suggestions, but in additional the uitableview has to be different than the results of search. For example: User starts typing 'wh': then shows a list with white, wheater, who, ... And then when press search button shows other list with the results. In this case the complication goes on uitableviewcell, because they are different cells with different fields. 回答1: I saw your question while i was looking for

Customizing appearance of UISearchBar & UINavigationBar in AppDelegate? Why customize at class and not instance level?

不问归期 提交于 2019-12-10 10:37:15
问题 I am following this tutorial. In its AppDelegate it has a customizeAppearance() where UISearchBar & UINavigationBar are type/class properties. Shouldn't they be a property of something like the window or the current viewController we are in?! How can we just message a class and then have it change our UI? FWIW when I cmmd click...obviously it just takes it to the class definition. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var

How to have the iOS SearchBar Keyboard Search Button Perform an Action

走远了吗. 提交于 2019-12-10 10:36:54
问题 I have a simple application which has a Table View (TV1) which gets populated by the user selecting a navigation bar button item to Add Entry (VC1). Within the Add Entry, when the user presses the Name field, they're taken to another Table View (TV2) which serves the purpose of allowing the user to select a previously entered name or create a new name. TV2 is a Table View Controller with a Search Bar at the top. Right now, existing names are available and show to the user. However, if the

Cancelling search with UISearchController causes crash

依然范特西╮ 提交于 2019-12-10 07:02:50
问题 In our app we have a UITableViewController that has a UISearchController: searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = self; [self.searchController.searchBar sizeToFit]; self.tableView.tableHeaderView = self.searchController.searchBar; self.showFooterView = YES; self.searchController.delegate = self; self.searchController.dimsBackgroundDuringPresentation = NO; // default is YES self.searchController.searchBar

How to change UISearchBar Icon to custom image?

萝らか妹 提交于 2019-12-10 02:33:41
问题 Currently, I have the default magnifying glass as my search bar icon. However, I want to put a custom image in its place, particularly this image: Custom Arrow Icon How would I go about changing the search bar default icon to the custom image? 回答1: you can use setImage function searchBar.setImage(UIImage(named: "your image"), forSearchBarIcon: .Search, state: .Normal) Swift3 searchBar.setImage(UIImage(named: "Image Name"), for: .search, state: .normal) 回答2: Way 1 : As luiyezheng answer, You

UISearchBar not showing keyboard when tapped

余生颓废 提交于 2019-12-10 02:22:07
问题 I programmatically added a UISearchBar in the view, did some initial setup. However, when I tap the search bar, the keyboard is not showing up. I looked up some question on this site, and none seems working for me. Here is the code snippets I used to setup the search bar self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(origin.x,origin.y,width,height)]; self.searchBar.searchBarStyle = UISearchBarStyleDefault; self.searchBar.translucent = YES; self.searchBar.barTintColor = [UIColor

UISearchBar text color

六眼飞鱼酱① 提交于 2019-12-10 01:23:44
问题 Browsed the documentation and I couldn't find anything to change the color of UISearchBar. Does anybody know how to change it? There isn't any textColor property :/ Thx 回答1: Works on iOS 7 and later: [[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setDefaultTextAttributes:@{ NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : [UIFont systemFontOfSize:15] }]; You may remove unused attribute as well. UPDATE . Due to appearanceWhenContainedIn is