//Storyboard透過Segue跳轉會呼叫這個methods
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//判斷segue identifier是否是你要的
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath];
//呼叫目的地的ViewController的方法來傳值
[[segue destinationViewController] setDetailItem:object];
}
}
沒有留言:
張貼留言