LoginSignup
1
0

More than 1 year has passed since last update.

[iOS] xibファイルを指定してViewControllerを生成する

Last updated at Posted at 2022-03-10

ボタンタップなどで遷移する場合に、特定のストーリボードのViewControllerを生成する方法

Bool nib_b = YES;
NSString* nibname = @"Nibname_A";

//  条件により表示させたいストリーボード名称をセット
if( nib_b ){
    nibname = @"Nibname_B";
}

// 特定のストーリーボードファイル名称のViewControllerを生成
UIViewController *vc = [[UIStoryboard storyboardWithName:nibname bundle:nil] instantiateViewControllerWithIdentifier:@"ViewConroller"];

// 生成したViewControllerへ遷移
[self.NavigationController pushViewController:vc animated:YES];

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0