iOS - Push viewController from code and storyboard

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

I have this code

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


        
5条回答
  •  盖世英雄少女心
    2020-12-01 19:00

    Use:

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"STORYBOARD_NAME" bundle:nil];
    PlaceViewController *newView = [storyboard instantiateViewControllerWithIdentifier:@"PlaceView"];
    [self presentViewController:newView animated:YES completion:nil];
    

    Or:

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"STORYBOARD_NAME" bundle:nil];
    PlaceViewController *newView = [storyboard instantiateViewControllerWithIdentifier:@"PlaceView"];
    [self.navigationController pushViewController:newView animated:YES];
    

提交回复
热议问题