2

我想在带有 tabBar 和外部 xib 的故事板之间传递数据。我尝试使用 prepareforsegue 但该方法未调用,或者如果我定义了一个 segue,则无法识别 this 。

我的代码是:

 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");
4

1 回答 1

0

而不是这个:

UIStoryboard *storyborad = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *view = [storyborad instantiateViewControllerWithIdentifier:@"<identifier>"];
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController pushViewController:view animated:YES];

尝试这个:

UIStoryboard *storyborad = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
BIDViewController *view = [storyborad instantiateViewControllerWithIdentifier:@"myIdentifier"];
view.isViewPushed = 1;
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController pushViewController:view animated:YES];
于 2013-10-24T14:37:28.880 回答