Skip to content

Instantly share code, notes, and snippets.

@jsai
Last active December 26, 2015 13:29
Embed
What would you like to do?
Search Bar cancel
UISearchBar *searchBar = [[UISearchBar alloc] init];
self.navigationItem.titleView = searchBar;
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"cancel", @"Cancel")
style:UIBarButtonSystemItemCancel
target:self
action:@selector(cancelButtonClicked)];
self.navigationItem.rightBarButtonItem = cancelButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment