Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to deploy iOS 7 mail.app search bar with cancel button functionality
    primarykey
    data
    text
    <p>I am looking to create a searchBar and while I have it somewhat working on my Table View, there's still a bit of effort required to get it 100% perfect. </p> <p>With reference to iOS 7 Mail.app, how do I deploy something like that? So a search bar that does not display the "cancel" button till you click in the search bar, and a cancel button that cancels the search and returns the table to where it was. </p> <p>I have the following code:</p> <pre><code>- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { _fetchedResultsController = nil; NSError *error; if (![[self fetchedResultsController] performFetch:&amp;error]) { NSLog(@"Error in search %@, %@", error, [error userInfo]); } else { [self.timelineTableView reloadData]; [self.timelineSearchBar resignFirstResponder]; [self.noResultsLabel setHidden:_fetchedResultsController.fetchedObjects.count &gt; 0]; } } - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { [self.timelineSearchBar resignFirstResponder]; self.timelineSearchBar.hidden = YES; [self.timelineTableView reloadData]; [self viewDidLoad]; } </code></pre> <p>So with this, I basically want the searchBar to be visible all the time in the Table View, and to NOT display the cancel button, till the user starts typing. If they perform a search and it produces results or it doesn't, I want the cancel button to:</p> <ul> <li>ResignFirstResponder of the search bar</li> <li>Remove the cancel button</li> <li>Return the Table view to how it was before the search. </li> </ul> <p>Thanks</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.
 

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