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

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

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

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题