iOS - Push viewController from code and storyboard

后端 未结 5 1210
我在风中等你
我在风中等你 2020-12-01 18:30

I have this code

 PlaceViewController *newView = [self.storyboard instantiateViewControllerWithIdentifier:@\"PlaceView\"];
 [self presentViewController:newVi         


        
5条回答
  •  [愿得一人]
    2020-12-01 19:25

    Objective-C:

    PlaceViewController *newView = [self.storyboard instantiateViewControllerWithIdentifier:@"storyBoardIdentifier"];
    [self.navigationController pushViewController:newView animated:YES];
    

    Please do notice below points,

    1. your storyboard identifier is correct.

    2. The root view have navigation Controller.

    Swift:

    let newView = self.storyboard?.instantiateViewController(withIdentifier: "storyBoardIdentifier") as! PlaceViewController
    self.navigationController?.pushViewController(newView, animated: true)
    

提交回复
热议问题