iPhone hide Navigation Bar only on first page

The nicest solution I have found is to do the following in the first view controller. Objective-C – (void)viewWillAppear:(BOOL)animated { [self.navigationController setNavigationBarHidden:YES animated:animated]; [super viewWillAppear:animated]; } – (void)viewWillDisappear:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:animated]; [super viewWillDisappear:animated]; } Swift override func viewWillAppear(_ animated: Bool) { self.navigationController?.setNavigationBarHidden(true, animated: animated) super.viewWillAppear(animated) } override func viewWillDisappear(_ animated: Bool) { self.navigationController?.setNavigationBarHidden(false, animated: … Read more

Setting action for back button in navigation controller

Try putting this into the view controller where you want to detect the press: -(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // back button was pressed. We know this is true because self is no longer // in the navigation stack. } [super viewWillDisappear:animated]; }

How to force view controller orientation in iOS 8?

For iOS 7 – 10: Objective-C: [[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@”orientation”]; [UINavigationController attemptRotationToDeviceOrientation]; Swift 3: let value = UIInterfaceOrientation.landscapeLeft.rawValue UIDevice.current.setValue(value, forKey: “orientation”) UINavigationController.attemptRotationToDeviceOrientation() Just call it in – viewDidAppear: of the presented view controller.

How to change the Push and Pop animations in a navigation based app

I did the following and it works fine.. and is simple and easy to understand.. CATransition* transition = [CATransition animation]; transition.duration = 0.5; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade //transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom [self.navigationController.view.layer addAnimation:transition forKey:nil]; [[self navigationController] popViewControllerAnimated:NO]; And the same thing for push.. Swift … Read more