uisearchbar

iPhone perform action when UITextField / UISearchBar's clear button is pressed

冷暖自知 提交于 2019-12-04 22:37:14
Is it possible to gain access to a delegate method that will allow additional actions to be performed when the "clear" button is pressed on a UITextField / UISearchBar? Thanks See: UITextFieldDelegate Protocol Reference If you set your view controller as the delegate for your text field (can be done in interface builder), you can use: - (void)clearSearchTextField { ... } - (BOOL)textFieldShouldClear:(UITextField *)textField { if (textField == self.searchTextField) [self clearSearchTextField]; return YES; } For Swift 3: To perform an action when the "clear" button is pressed on a UITextField

How do I link the search bar to display results in swift/xcode

前提是你 提交于 2019-12-04 22:07:50
I am currently working on using a Microsoft Exchange API for an application that allows me to look up a user based on typing in part of a name. I wanted to know how to link the search bar so that it displays related terms. Below I posted my code/ attempts func HTTPPost(aaplication: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { var request = NSMutableURLRequest(URL: NSURL(string: "http://mail.SAP.com/EWS/Exchange.asmx")!) var session = NSURLSession.sharedSession() request.HTTPMethod = "Post" return true } @IBOutlet weak var SearchBar: UISearchBar! I also

SearchBar in Navigation Bar in iOS7

↘锁芯ラ 提交于 2019-12-04 21:26:53
I have a tableview containing all the countries and their flags. I've been working to add a search bar and had it all working until I decided to move the search bar into the navigation bar allowed in iOS7 (for my purposes, that layout works very well). Now, the table loads fine, the search bar shows up fine. As I type into the search bar, I can see the filtered list being built via the console. All looks good, EXCEPT the search results table never displays. In other words, I don't see the filtered list in a new tableview. This method is being called to build the filtered list: -(void

UINavigationController + UITableView + UISearchBar + UISplitViewController

﹥>﹥吖頭↗ 提交于 2019-12-04 20:43:47
I have an annoying problem. I have an UINavigationController with an UITableView in the Master (Left) pane of my UISplitViewController. When I do normal operations, things push on on to the navigation controller fine. alt text http://files.droplr.com/files/8851942/WDO5y.working.jpg However, when I do a search and push things on, it's like it doesn't account for the space the navigation bar needs. It pushed the new controller on at the very top, then puts the navbar on, overlapping the content! alt text http://files.droplr.com/files/8851942/WDRem.search.jpg I should add it works fine when doing

UITableView search bar?

天大地大妈咪最大 提交于 2019-12-04 19:57:05
is there any easy way in the iPhone SDK to include search bars like those in the iPod app or in the Contacts app? (They behave and look unlike the usual UISearchBars ...) -- Ry Check out UISearchDisplayController. It handles the repositioning of the search bar, the graying of the screen, etc, etc, etc. UIViewController has a UISearchDisplayController property, so it's pretty easy to hook up. There's also the TableSearch sample code. This adds a search bar to a table view as the header view. This means that it scrolls with the table view: - (void) viewDidLoad { [super viewDidLoad]; UISearchBar*

UISearchBar that Ignores Special Characters when Searching UITableView Cell

北慕城南 提交于 2019-12-04 19:39:26
Thanks to the help of those on SO, I have a great UISearchBar that filters my UITableView. There is one more feature that I'd like to add. I would like the UISearchBar filter to ignore special characters like apostrophes, commas, dashes, etc... and to allow cells with text like "Jim's Event" or "Jims-Event" to still come up if the user types "Jims Event". for (NSDictionary *item in listItems) { if ([scope isEqualToString:@"All"] || [[item objectForKey:@"type"] isEqualToString:scope] || scope == nil) { NSStringCompareOptions opts = (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch); NSRange

UISearchBar clipped under status bar when added to UISearchDisplayController

柔情痞子 提交于 2019-12-04 19:01:50
问题 I want my search bar to draw its background extended upwards below the status bar like this: This is the corresponding code for the image above: - (void)viewDidLoad { [super viewDidLoad]; self.searchBar = [[UISearchBar alloc] init]; self.searchBar.delegate = self; [self.view addSubview:self.searchBar]; self.searchBar.translatesAutoresizingMaskIntoConstraints = NO; NSDictionary *views = @{@"v":self.searchBar, @"topLayoutGuide":self.topLayoutGuide}; [self.view addConstraints:[NSLayoutConstraint

Searching a TableView of annotations

情到浓时终转凉″ 提交于 2019-12-04 18:31:42
I had no idea how to set up a database when i started so i have 80 annotations that all look like this workingCoordinate.latitude = 50.795825; workingCoordinate.longitude = -1.103139; MainViewAnnotation *Levant = [[MainViewAnnotation alloc] initWithCoordinate:workingCoordinate]; [Levant setTitle:@"Levant"]; [Levant setSubtitle:@"Unit R09, Gunwharf Quays"]; [Levant setAnnotationType:MainViewAnnotationTypePortsmouth]; [mapView addAnnotation:Levant]; They are grouped into 22 cities through the MainViewAnnotationType, which is coded as follows: - (NSInteger)numberOfSectionsInTableView:(UITableView

uitableview reloadData issue

可紊 提交于 2019-12-04 18:16:59
I've been debugging my iphone app and found something interesting. I have a UIViewControllers with TabBarcontroller( 6 tabs). Each tab is a UIViewController and it has a UITtableview. The viewDidLoad works and brings the initial data. On of the UITableView has a search bar. After the user touchs presses search some magic happens and I get an array with data. I cant see the new data in the tableview and the [tableView reloadData] has no effect outside viewDidLoad (first time). I can see the array holding the data and the dataSource is set to self. Yet, no displaying of data! so I 've tried

SearchBar not displaying results until cancel button clicked

好久不见. 提交于 2019-12-04 18:04:55
I have implemented a UITableView with search bar (and search display) - all works fine, but the table results do not get updated until the search bar cancel button is tapped. Delegate methods: - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { // asynchronous request with [self.tableView reloadData] in the connectionDidFinishLoading [self getProductData:searchBar.text]; [searchBar resignFirstResponder]; [self.tableView reloadData]; } - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { } - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { }