Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用tabBar和外部xib在序列图像板之间传递数据_Ios_Objective C_Storyboard_Xib_Segue - Fatal编程技术网

Ios 使用tabBar和外部xib在序列图像板之间传递数据

Ios 使用tabBar和外部xib在序列图像板之间传递数据,ios,objective-c,storyboard,xib,segue,Ios,Objective C,Storyboard,Xib,Segue,我想在带有tabBar和外部xib的故事板之间传递数据。 我尝试使用prepareforsegue,但该方法没有调用,或者如果我定义了一个segue,则无法识别 我的代码是: UIStoryboard *storyborad = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *view = [storyborad instantiateViewControllerW

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

我的代码是:

 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
与此相反:

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

您在xib中设置了标识符了吗?您有一个故事板,并且希望推送到nib文件,没有?因此,您可以使用[self-PerformsgueWithIdentifier@“try”sender:self],但需要在目标nib中设置该标识符(“try”)。在nib中设置标识符后,将调用prepareSegue函数。是的,但它是这样的:故事板中的外部nib-->视图,所以我所做的是定义(给它们标识符)nib本身(在故事板中)和segue,但仍然写着“Receiver()没有带标识符的segue”看看这个帖子,因为他们有相同的问题,让我们知道:这不起作用。。我想添加一些可以帮助外部nib在故事板之外的东西(它属于拥有自己nib文件的类)我成功地在故事板中打开了视图,但我也需要传递数据可能我没有正确设置segue标识符?视图没有连接到具有此属性的类sorry for double post,但是问题仍然存在,您可以检查BIDViewController中的视图是否为nil吗?在初始化它之后放置一个断点,并在初始化它之后查看视图或NSLog(@“%@”,view)的值是多少Its not nil。如果我按下视图,我可以传递数据,或者我有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];