したがって、基本的にアプリのロード時にいくつかの Viewcontrollers をプッシュしようとすると問題が発生し、既に登録されているかどうかがチェックされ、登録されている場合は差分 VC に送信され、登録されていない場合は RegisterVC に送信されます。それはストーリーボードで行われ、問題は、コードをviewDidLoadに配置するとプッシュが機能することですが、ストーリーボードからrootviewcontrollerが表示されませんが、コードをコーダーでinitに移動するとviewcontrollerが表示されますが、プッシュリターンの新しい VC にプッシュするはずのメソッドに nil があるため、遷移は発生しません。
コードは次のようになります。
if (emp == nil) {
[self gotoRegisterView];
}
else {
[self gotoSMWView];
}
と :
- (void) gotoRegisterView {
UIViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"RegisterVC"];
[self.navigationController pushViewController:vc animated:YES];
}
- (void) gotoSMWView {
UIViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SMWVC"];
[self.navigationController pushViewController:vc animated:YES];
}
どんな提案でも大歓迎です。