我在我的项目中使用storyboard和xib,我想从storyboard转到xib文件但不能反转它。所以我如何从xib文件转到storyboard。 thnx提前。 故事板到xib:
Dashboard1ViewController *tempView = [[Dashboard1ViewController alloc] initWithNibName:@"Dashboard1ViewController" bundle:nil];
tempView.passemail = [matches valueForKey:@"email"];
[self.view addSubview:tempView.view];
它工作正常但xib到故事板我使用了这段代码
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"loginUI" bundle:nil];
login2ViewController *vc = [sb instantiateViewControllerWithIdentifier:@"login2"];
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:vc animated:YES completion:NULL];
但它不起作用。
答案 0 :(得分:0)
以下方法对我有用。确保您的标识符正确
YourViewController *urViewController = (YourViewController *)[[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateViewControllerWithIdentifier:@"storyboardID"];
[self presentViewController:urViewController animated:YES completion:nil];
答案 1 :(得分:0)
将nil
更改为[NSBundle mainBundle]
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"loginUI"
bundle:[NSBundle mainBundle]];