ios - UISearchBar Cancel Button Not Working -


i have uisearchbar on mkmapview i'm going use search annotations. i'm having trouble getting cancel button work. create search bar in viewdidload method this:

uisearchbar *searchbar = [[uisearchbar alloc] init];     searchbar.frame = cgrectmake(0, 0, 320,44);     searchbar.showsbookmarkbutton = no;     searchbar.showscancelbutton = yes;     [self.view addsubview:searchbar]; 

and i've implemented method cancel button:

- (void)searchbarcancelbuttonclicked:(uisearchbar *)searchbar {     [searchbar resignfirstresponder]; } 

what doing wrong?

you haven't assigned search bar delegate.

searchbar.delegate = self 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -