我想要在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