0
我试图穿过这个代码塞格斯传递数据:准备Segue公司通数据选择
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"exerciseDetailDescription"]) {
SoulExerciseDetailQuarViewController *destination = segue.destinationViewController;
if ([destination respondsToSelector:@selector(setOverview:)]) {
NSDictionary *overview = @{@"name" : [_exercise objectForKey:@"name"], @"longDescription" : [_exercise objectForKey:@"longDescription"]};
[destination setValue:overview forKey:@"overview"];
}
}
else if ([segue.identifier isEqualToString:@"exerciseDetailGear"]) {
SoulExerciseDetailTriaViewController *destination = segue.destinationViewController;
if ([destination respondsToSelector:@selector(setSelectedGearString:)]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
NSString *selectedGearString = cell.detailTextLabel.text;
[destination setValue:selectedGearString forKey:@"selectedGearString"];
}
}
else if ([segue.identifier isEqualToString:@"exerciseDetailCategory"]) {
SoulExerciseDetailDuaViewController *destination = segue.destinationViewController;
if ([destination respondsToSelector:@selector(setSelectedCategoryString:)]) {
NSLog(@"Go");
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
NSString *selectedCategoryString = cell.detailTextLabel.text;
[destination setValue:selectedCategoryString forKey:@"selectedCategoryString"];
}
}}
所以,如果响应是在SEGUE的目的地发现二传手它允许数据的传输。
奇怪的是,第一个正确,但在第二和第三响应,它说,目的地视图控制器不响应这些设定器
例如在第三中未示出的NSLog。从先前的评论
它说导航控制器 – 2013-02-23 00:32:42
之间的类开始segue和它到达的类有一个导航控制器导航栏,因为它的模态segue导航栏到目的地。我试图设置目的地作为导航控制器,并得到它的根视图控制器,但它不允许。 – 2013-02-23 00:41:38
没关系,做到了。我如何接受你的回答? – 2013-02-23 00:49:37