ios 页面跳转

xib跳到Storyboard

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewOfStoryboard = [storyboard instantiateInitialViewController];

viewOfStoryboard.view.backgroundColor = [UIColor whiteColor];
[self dismissViewControllerAnimated:YES completion:nil];
[self presentViewController:viewOfStoryboard animated:YES completion:nil];

xib跳到ViewController

if (self.settingVC == nil) {

    self.settingVC = [[SettingViewController alloc] init];
    self.settingVC.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    
}

[self.view addSubview:self.settingVC.view];

通过storyboard跳转到相对应的viewcontroller

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"dail" bundle:nil];
VoiceViewController *voiceViewController = [storyboard instantiateViewControllerWithIdentifier:@"VoiceViewControllerId"];

[self.navigationController pushViewController:voiceViewController animated:YES]

你可能感兴趣的:(ios 页面跳转)