ios - Unable to hide keyboard on click search button in a UISearchBar -
i using uisearchbar
search list, when click on search button on keyboard, keyboard not hide.
please me fix issue.
here code
-(void)search:(uisearchbar*)searchbar text:(nsstring*)text { [copylistofitems removeallobjects]; if([text length] > 0) { // [ovcontroller.view removefromsuperview]; searching = yes; nsstring *searchtext = searchbar.text; for(imergencydata *objtrust in arytrustee) { nsrange titleresultsrange = [objtrust.strname rangeofstring:searchtext options:nscaseinsensitivesearch]; if (titleresultsrange.length > 0) [copylistofitems addobject:objtrust]; } nslog(@"number of object found %d",copylistofitems.count); } else { // [tbltrustee insertsubview:ovcontroller.view abovesubview:self.parentviewcontroller.view]; [searchbar resignfirstresponder]; searching = no; //tbltrustee.scrollenabled = no; } [tbltrustee reloaddata]; } -(void)searchbartextdidendediting:(uisearchbar *)asearchbar { [asearchbar resignfirstresponder]; [self.view endediting:yes]; } //method call when type text in search box -(void)searchbar:(uisearchbar *)thesearchbar textdidchange:(nsstring *)searchtext { [self search:thesearchbar text:searchtext]; } //method call when on search button -(void)searchbarsearchbuttonclicked:(uisearchbar *)searchba{ [searchba endediting:yes]; [searchba resignfirstresponder]; [self search:searchba text:searchbar.text]; }
put line of code , try once,
- (void)searchbartextdidendediting:(uisearchbar *)asearchbar { [asearchbar resignfirstresponder]; [self.view endediting:yes]; }
(or) edit
:
- (void)searchbarsearchbuttonclicked:(uisearchbar *)searchbar{ [searchbar resignfirstresponder]; [self.view endediting:yes]; }
Comments
Post a Comment