zoukankan      html  css  js  c++  java
  • storyboard ID

    The storyboard ID is a String field that you can use to create a new ViewController based on that storyboard ViewController. An example use would be from any ViewController:

    //Maybe make a button that when clicked calls this method
    
    - (IBAction)buttonPressed:(id)sender
    {
        MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
    
       [self presentViewController:vc animated:YES completion:nil];
    }

    This will create a MyCustomViewController based on the storyboard ViewController you named "MyViewController" and present it above your current View Controller

    And if you are in your app delegate you could use

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                             bundle: nil];

    Edit: Swift

    @IBAction func buttonPressed(sender: AnyObject) {
        let vc = storyboard?.instantiateViewControllerWithIdentifier("MyViewController") as MyCustomViewController
        presentViewController(vc, animated: true, completion: nil)
    }

    and

    let storyboard = UIStoryboard(name: "MainStoryboard", bundle: nil)
  • 相关阅读:
    SqlServer卡慢解决办法
    His表(简化)
    解决Oracle数据库空间不足问题
    获取select下拉框选中的的值
    使用编辑器Sublime
    Angularjs中的$filter
    Angularjs 的Controlleras 和$scope
    在html页面中实现代码的高亮显示
    Angularjs的ui-router
    TML5之Canvas
  • 原文地址:https://www.cnblogs.com/welhzh/p/4324977.html
Copyright © 2011-2022 走看看