【发布时间】:2013-07-26 17:36:10
【问题描述】:
在情节提要中,我想将数据从一个视图控制器传递到另一个视图控制器,但只有属性是共享的,但是我如何通过使用参数(方法)来共享数据。在下面我尝试过这样
Tableview 选择方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier:@"ASEventDetail" sender:self];
}
在为 segue 做准备时,我在方法“[vc loadDict:[eventArr objectAtIndex:0]]”中传递参数值
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"ASEventDetail"]){
// Get reference to the destination view controller
ASEventDetail *vc = [segue destinationViewController];
// Pass any objects to the view controller here, like...
[vc loadDict:[eventArr objectAtIndex:self.view.tag]];
}
}
能否请任何人帮助我使用情节提要中的方法将数据从一个传递到另一个。
【问题讨论】:
-
我想
loadDict是你自己的方法吗?这里有什么问题?您还可以通过目标视图控制器上的属性传递数据。 -
loadDict 是我自己的方法,我的问题是通过属性传递数据时没有问题,但是在这里我想通过方法来传递数据。我无法传递数据,因为首先是我的方法被调用,然后调用 viewdidload 就是我的问题
-
不知道我是否理解您的问题,但如果您使用 popover,请查看我的问题:stackoverflow.com/questions/8838160/…
-
你是对的,那是我的问题@Leonard 你能帮我找到解决办法吗
标签: ios objective-c storyboard segue