iphone - Custom UISearchBar in navigationItem ios7 -


i have customized uisearchbar want display in self.navigationitem.titleview. have no problem getting in there , looking way want think wrong how connect uisearchdisplaycontroller.

here uisearchbar , uisearchdisplaycontroller in viewdidload:

searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0.0,0.0,200.0, 22.0)]; searchbar.barstyle = uisearchbarstyledefault; searchbar.showscancelbutton = no; searchbar.placeholder = @"search"; searchbar.delegate = self; self.navigationitem.titleview = searchbar;  searchdisplaycontroller = [[uisearchdisplaycontroller alloc] initwithsearchbar:searchbar contentscontroller:self]; searchdisplaycontroller.delegate = self; searchdisplaycontroller.searchresultsdelegate = self; searchdisplaycontroller.searchresultsdatasource = self; 

at point search function not working. if add [searchdisplaycontroller setdisplayssearchbarinnavigationbar:yes]; search function works messes style i had added searchbar.

edit: additional information: looks [self.searchdisplaycontroller.searchresultstableview reloaddata]; not getting called. have following implemented:

-(bool)searchdisplaycontroller:(uisearchdisplaycontroller *)controller shouldreloadtableforsearchstring:(nsstring *)searchstring -(void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope 

for reason if don't call [searchdisplaycontroller setdisplayssearchbarinnavigationbar:yes]; data not reloaded. perhaps missing method.

upon searching looks - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section gets called , tableview == self.searchdisplaycontroller.searchresultstableview true, not proceed call - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

well, think way work embed uisearchbar uiview, i'm okay style although have been able make same.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -