Modal View with Navigation Controller

前端 未结 3 1164
耶瑟儿~
耶瑟儿~ 2020-12-13 07:59

still cannot figure out what I am doing wrong. Just trying to get a modal view with a navigation controller inside.

Here is my project http://www.matthewpateman.com/

3条回答
  •  感情败类
    2020-12-13 08:23

    Present it as a modal view and wrap the controller in a navigation controller to provide a navigation bar in case you want to add edit, save, etc buttons

    ModalViewController *modalController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
    modalController.delegate = self; // Set any delegate you may have
    
    // This is where you wrap the view up nicely in a navigation controller
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController];
    
    // You can even set the style of stuff before you show it
    navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    
    // And now you want to present the view in a modal fashion
    [self presentModalViewController:navigationController animated:YES completion:nil];
    

提交回复
热议问题