你好,我想傳遞變量與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