Accessing a view controller created through Storyboard using the App Delegate

后端 未结 7 1715
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 10:41

I\'m working on an iOS5 app using storyboard, and I have a method in a view controller class that i\'d like to access from the App Delegate. The trouble is, this view contr

相关标签:
7条回答
  • 2020-12-09 11:44

    If you are using a storyboard, and you want instance of a viewController in storyboard you can use the following

    UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    id viewcontroller = [mystoryboard instantiateViewControllerWithIdentifier:@"identifier"];
    

    Here the 'identifier' is the name provided in the particular viewController's 'storyBoard ID' in 'Identity' section in 'Identity Inspector'.

    0 讨论(0)
提交回复
热议问题