uisearchbar - bar button created from childViewController don't work -


i have parentviewcontoller(with uinavigationitem), , childviewcontoller(with uitableviewcontoller, uisearchbar). want create uibarbuttonitem on click searchbar hiding.

tableviewcontoller.h(childviewcontoller)  @interface tableviewcontroller : uitableviewcontroller<uisearchbardelegate, uisearchdisplaydelegate, uinavigationcontrollerdelegate>  @property (nonatomic, strong) iboutlet uisearchbar *searchbar; @end  tableviewcontoller.m(childviewcontoller) @synthesize searchbar;  - (void)viewdidload  {     [super viewdidload];     self.searchbar.hidden = no;     [self createsearchbutton]; } - (void) createsearchbutton {     uibarbuttonitem *mybutton = [[uibarbuttonitem alloc] initwithtitle:@"mybutton" style:uibarbuttonitemstylebordered target:self action:@selector(ibutton:)];     self.parentviewcontroller.navigationitem.rightbarbuttonitem = mybutton; }  -(void) ibutton {     self.searchbar.hidden = yes;     nslog(@"click on ibutton"); } 

but, if click on mybutton, nslog displayed, , searchbar not hidden. why code don't work?


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -