當在創建一個controller的時候,我們在init方法中,可以將其屬性都給定義了。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.title=@"third";
//當我被push進去的時候才
self.hidesBottomBarWhenPushed=YES;
}
return self;
}
那想navigationBar 隱起來呢?我們就在
當我這張圖要出現的時候,發出了一個通知,將navigationBar隱起來。
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden=YES;
}
這都被隱起來了,怎麼返回呢?
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self.navigationController popViewControllerAnimated:YES];
}
那前一個的也沒有,因爲navigationController被大家共用,
所以當這個view要走的時候,我們將navigatonController
navigationController.navigationBarhidden=NO;就可以啦!