我最近已从Storyboard转换为XIB。因为我有大量的视图,并且通过git存储库使用XIB更加容易。 (该应用程序现在将可用于iOS 4)。
现在,这里是我曾经拥有的代码,但是我想知道如果没有Storyboard,而有了XIB,我将如何实现相同的目标:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle bundleForClass:[self class]]];
infoView *infoViewController = [storyboard instantiateViewControllerWithIdentifier:[defaults objectForKey:@"launchScreen"]];
infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:infoViewController animated:YES completion:nil];
最佳答案
首先,您应该将Storyboard的infoView
转换为infoView.xib
,然后:
infoView *infoViewController = [[infoView alloc]initWithNibName:@"infoView" bundle:nil];
infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:infoViewController animated:YES completion:nil];
关于objective-c - Storyboard-> XIB |加载 View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11979633/