Ios 如何使用相同的工具栏按钮显示/隐藏搜索栏
我有一个工具栏按钮Ios 如何使用相同的工具栏按钮显示/隐藏搜索栏,ios,xcode,button,show,searchbar,Ios,Xcode,Button,Show,Searchbar,我有一个工具栏按钮 UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(pressButton2:)]; systemItem2.style = UIBarButtonItemStyleBordered; 还有一场新闻发布会 - (void) pressBut
UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(pressButton2:)];
systemItem2.style = UIBarButtonItemStyleBordered;
还有一场新闻发布会
- (void) pressButton2:(id)sender{
mapSearch.hidden = NO;
}
在视图中将出现
- (void)viewWillAppear:(BOOL)animated
{
mapSearch.hidden = YES;
}
如何使用同一按钮(第二次按下)显示和隐藏搜索栏?我知道您想切换
mapSearch.hidden
。这里有一个解决方案
mapSearch.hidden = !mapSearch.hidden;
或
我知道您想切换
mapSearch.hidden
。这里有一个解决方案
mapSearch.hidden = !mapSearch.hidden;
或