#import <UIViewController+instantiate.h>
。您的 .pch
文件是最好的位置。@"MyCoolHomeScreen"
。- (void)someAction {
MyCustomVC *customVC = [MyCustomVC instantiateWithIdentifier:@"MyCoolHomeScreen"];
// Do something
[self presentViewController:customVC animated:YES completion:nil];
}
...或者将 Storyboard ID 设置为与类名相同。例如 @"MyCustomVC"
。并使用此方法
- (void)someAction {
MyCustomVC *customVC = [MyCustomVC instantiateFromStoryboard];
// Do something
[self presentViewController:customVC animated:YES completion:nil];
}
与 iOS 7+ 一起工作。与 ARC 兼容。
然后运行 pod install
或 pod update
orkenstein,[email protected]
AAStoryboardInstantiate 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。