【发布时间】:2015-12-19 08:32:15
【问题描述】:
我需要从View Controller to a child of a parent view controller. 传递数据
prepareSegue 没有传递数据。
我需要在 viewdidload 之前通过它。
这是我如何尝试将信息从视图控制器传递给父级的子级。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// NSLog(@"prepareForSegue: %@",segue.identifier);
ViewController2 *transfer = segue.destinationViewController;
if ([segue.identifier isEqualToString:@"Test"]) {
transfer.testLabel = @"Pass this data";
}
}
【问题讨论】:
-
能否请您发布您的代码,然后我会尝试找出数据未通过的原因。问候,亚历克斯
-
我假设在将 segue 推送到父级时,您不能将数据从 VC 传递给父级 VC 的子级?
-
@AlexWoe89 我用代码更新了我的问题
标签: ios objective-c view uiviewcontroller