gpt4 book ai didi

ios - 在带有 tabBar 和外部 xib 的 Storyboard之间传递数据

转载 作者:行者123 更新时间:2023-12-01 16:46:32 25 4
gpt4 key购买 nike

我想在带有 tabBar 和外部 xib 的 Storyboard之间传递数据。
我尝试使用 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");

最佳答案

而不是这个:

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];

关于ios - 在带有 tabBar 和外部 xib 的 Storyboard之间传递数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19564284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com