你好,我想传递变量与segue。正在使用tableView:willSelectedRowAtIndexPath:正确的方式来传递变量?
我得到变量传递与tableView:willSelectedRowAtIndexPath:这是正确的方式?如果不是,我该如何实现这一目标? (注意:它是这样工作的。)
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
selectedCoffeeShop = [coffeeShops objectAtIndex:indexPath.row];
return indexPath;
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"coffeeShopDetailSegue"]) {
CoffeeShopDetailViewController *controller = (CoffeeShopDetailViewController *)segue.destinationViewController;
[segue destinationViewController];
controller.coffeeShop = selectedCoffeeShop;
}
}
肯定的,只是删除了'[Segue公司destinationViewController]' – AMI289 2014-10-27 12:37:03