Saturday, June 8, 2013

UINavigationController navigationBarHidden example in Objective C (iOS).


UINavigationController navigationBarHidden

A Boolean value that determines whether the navigation bar is hidden.

@property(nonatomic, getter=isNavigationBarHidden) BOOL navigationBarHidden

Discussion of [UINavigationController navigationBarHidden]
If YES, the navigation bar is hidden. The default value is NO. Setting this property does not animate the hiding or showing of the navigation bar; use setNavigationBarHidden:animated: for that purpose.

UINavigationController navigationBarHidden example.
- (void)viewDidLoad
{
    [super viewDidLoad];
     self.title = @"My Title";
     self.navigationController.navigationBarHidden = YES; //YES : 숨기기, NO : 보이기
}

Example of [UINavigationController navigationBarHidden].
CATransition *transition = [CATransition animation];
transition.duration = kAnimationDuration;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromTop;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];

self.navigationController.navigationBarHidden = NO;
[self.navigationController pushViewController:tableViewController animated:YES];

UINavigationController navigationBarHidden example.
Use this in first view controller:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[self navigationController] setNavigationBarHidden:YES animated:animated];
}

End of UINavigationController navigationBarHidden example article.