I have a toolbar button
UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(pressButton2:)];
systemItem2.style = UIBarButtonItemStyleBordered;
and a press action
- (void) pressButton2:(id)sender{
mapSearch.hidden = NO;
}
in viewWillAppear
- (void)viewWillAppear:(BOOL)animated
{
mapSearch.hidden = YES;
}
How can I show and hide searchbar with same button (second press)?
I understand you would like to toggle the
mapSearch.hidden. Here is a solutionor