@interface ViewController ()
{
BOOL
isflage;
}
@end
@implementation ViewController
- (
void
)viewDidLoad
{
[super viewDidLoad];
isflage = YES;
[self.navigationController setNavigationBarHidden:isflage animated:YES];
}
#pragma mark onClick
-(
void
)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
isflage = !isflage;
[self.navigationController setNavigationBarHidden:isflage animated:YES];
}
@end
<P>
上述代码的实现结果就是:
</P>
<P>
先隐藏navigationController,之后点击会显示,再点击又会隐藏,超简单吧。
</P>
<P>
同样tabBarController也是同样的实现结果。
</P>