Note that there are some explanatory texts on larger screens.

plurals
  1. POClicking on cross button of UISearchBar after clicking search button crashed the app?
    primarykey
    data
    text
    <p>Hello guys I have write the following code for implementing search bar and is working fine</p> <pre><code> - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { return YES; }// return NO to not become first responder - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { isSearchOn=YES; } - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { searchBar.text=@""; isSearchOn=NO; [searchBar resignFirstResponder]; } - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { if ([searchText length]&gt;0) isSearchOn=YES; else isSearchOn=NO; NSLog(@"search text %@",searchText); [self searchText:searchText]; [table reloadData]; } - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { isSearchOn=NO; [searchBar resignFirstResponder]; } -(void)searchText:(NSString*)str { NSLog(@"search text"); [resultArray removeAllObjects]; if (segmentControl.selectedSegmentIndex==0) { for (NSDictionary *CellDix in FriendSuggestion) { NSRange titleResultRange = [[CellDix valueForKey:@"itemid.item"] rangeOfString:str options: (NSCaseInsensitiveSearch | NSLiteralSearch)]; NSRange titleRangePopular=[[CellDix valueForKey:@"usagecategoryid.usagecategory"] rangeOfString:str options:(NSCaseInsensitiveSearch | NSLiteralSearch)]; if (titleResultRange.length &gt; 0 || titleRangePopular.length&gt;0) [resultArray addObject:CellDix]; } }else { for (NSDictionary *CellDix in popularSuggestion) { NSRange titleResultRange = [[CellDix valueForKey:@"itemid.item"] rangeOfString:str options: (NSCaseInsensitiveSearch | NSLiteralSearch)]; NSRange titleRangePopular=[[CellDix valueForKey:@"usagecategoryid.usagecategory"] rangeOfString:str options:(NSCaseInsensitiveSearch | NSLiteralSearch)]; if (titleResultRange.length &gt; 0 || titleRangePopular.length&gt;0) [resultArray addObject:CellDix]; } } NSLog(@"cellDics array %@",resultArray); } </code></pre> <p>but I m getting problem that when I search text on search bar then click search and after that I click cross button on the right side of the search bar text then app crashes any body knows how this problem can be removed . Thank you..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload