presentViewController and displaying navigation bar

后端 未结 12 469
自闭症患者
自闭症患者 2020-12-07 13:27

I have a view controller hierarchy and the top-most controller is displayed as a modal and would like to know how to display the navigation bar when using

\         


        
12条回答
  •  离开以前
    2020-12-07 14:24

    I had the same problem on ios7. I called it in selector and it worked on both ios7 and ios8.

    [self performSelector: @selector(showMainView) withObject: nil afterDelay: 0.0];
    
    - (void) showMainView {
        HomeViewController * homeview = [
            [HomeViewController alloc] initWithNibName: @
            "HomeViewController"
            bundle: nil];
        UINavigationController * navcont = [
            [UINavigationController alloc] initWithRootViewController: homeview];
        navcont.navigationBar.tintColor = [UIColor whiteColor];
        navcont.navigationBar.barTintColor = App_Theme_Color;
        [navcont.navigationBar
        setTitleTextAttributes: @ {
            NSForegroundColorAttributeName: [UIColor whiteColor]
        }];
        navcont.modalPresentationStyle = UIModalPresentationFullScreen;
        navcont.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self.navigationController presentViewController: navcont animated: YES completion: ^ {
    
        }];
    }
    

提交回复
热议问题