如何在objective-c程序中直接调用要显示的storyboard


一般都是在应用启动时就会加载storyboard,但是对于我这新手来说,有的已经用代码实现了界面,只是最后一个页面用了storyboard,问题来了,我之前都是代码,如何在代码中加载运行这个storyboard页面。

storyboard ios xcode objective-c

游客Mk-II 8 years, 8 months ago

在storyboard界面的最左边,有个箭头,方向向右,点击这个箭头拖拽到最后一个界面,这样启动程序的时候直接就是显示箭头指向的界面了

cargo answered 8 years, 8 months ago


 UIViewController *con=[[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@”yourIdentifier”]; //根据标识符获得控制器,要先给storyboard设置identifier
[self.navigationController pushViewController:con animated:YES]; // 加载控制器
}

EDG旋转爆炸 answered 8 years, 8 months ago

Your Answer