我想要在storyboard与tabBar和外部xib之间传递数据。 我试图使用prepareforsegue,但该方法没有调用,或者如果我定义了一个segue,但没有认识到这一点。在storyboard与tabBar和外部xib之间传递数据
我的代码是:
UIStoryboard *storyborad = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *view = [storyborad instantiateViewControllerWithIdentifier:@"<identifier>"];
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController pushViewController:view animated:YES];
// [self performSegueWithIdentifier:@"try" sender:self]; // tried to use performSegueWithIdentifier but this recognize identifier
和prepareforsegue方法代码:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
BIDViewController *viewControllerView = segue.destinationViewController;
viewControllerView.isViewPushed=1;
NSLog(@"prepareForSegue");
您是否在xib中设置了标识符? – Alex
故事板中没有 – user2915374
你有一个故事板,你想推到一个笔尖文件,不是吗?所以你可以使用[self performSegueWithIdentifier @“try”sender:self],但是你需要在目标nib中设置该标识符(“try”)。在nib中设置标识符后,prepareSegue函数将被调用。 – Alex