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)
  • 相关阅读:
    PyQt4信号与槽
    Amazon Redshift数据库
    NoSQL数据库的认识
    如何划分子网
    VPC见解
    Linux之添加交换分区
    MySQL基础之 标准模式通配符
    MySQL基础之 LIKE操作符
    MySQL基础之 AND和OR运算符
    MySQL基础之 索引
  • 原文地址:https://www.cnblogs.com/welhzh/p/4324977.html
Copyright © 2011-2022 走看看