但也可以如下列程式碼用performSegueWithIdentifier
-(void)buttonAction:(id)sender { [self performSegueWithIdentifier:@"MySegueName" sender:sender]; }
//在執行上面的method之後,會先進來這個method,你可以在此把值pass進去
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"MySegueName"]) { NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; NSDate *object = _objects[indexPath.row]; [[segue destinationViewController] setDetailItem:object]; } }
沒有留言:
張貼留言