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)
  • 相关阅读:
    上传文件事件并校验:event.target.files && event.target.files[0]
    深浅拷贝
    Git学习
    Flex弹性布局
    hive
    222
    错误总结
    Redis小结2
    spark小结
    kafka详解
  • 原文地址:https://www.cnblogs.com/welhzh/p/4324977.html
Copyright © 2011-2022 走看看