iphone - How to access searchBar's clear text button? -
when hit "clear" button (the 1 appears when editing) on tableview search, trying keyboard disappear. how can detect when "clear" button clicked, can resign firstresponder? tried in textdidchange
method:
if (searchbar.text == @"") { [searchbar resignfirstresponder]; nslog(@"clear called"); }
which did not work...and tried:
if (searchbar.text == nil) { [searchbar resignfirstresponder]; nslog(@"clear called"); }
neither methods show called. ideas?
edit: resignfirstresponder not seem working. keyboard stays on screen. what's doing wrong?
for string comparision u should use
if([searchbar.text isequaltostring: @""])
Comments
Post a Comment