zoukankan      html  css  js  c++  java
  • iOS故事板下使用代码跳转页面

    如今iOS8下,使用Storyboards开发十分方便,搭配上Size Class后,并且适配更加便捷。

    但是突然由代码写界面或者xib转向故事板,难免有一些疑惑。

    由于故事板下,基本使用连续来跳转页面,但有些情况下总会用到代码控制页面跳转,这个时候传统的初始化ViewController后push过去会出现一个黑色屏幕,什么内容都没用。

    解决方案:

    UIStoryboard *story = [UIStoryboard storyboardWithName:@"填写故事板名称" bundle:nil];
    UIViewController *vc = [story instantiateViewControllerWithIdentifier:@"填写ViewController在故事板中设置的identifier"];

    [vc setModalPresentationStyle:UIModalPresentationFullScreen];

    [self.navigationController pushViewController:vc animated:YES];

  • 相关阅读:
    Arr
    class4
    class3联大网页
    class33
    class3
    人机交换 NO 1书签
    大数据的框架与特点
    mapreduce排序
    mapreduce求平均数
    mapreduce去重
  • 原文地址:https://www.cnblogs.com/mo-shou/p/4209614.html
Copyright © 2011-2022 走看看