如何将对象从详细信息公开点击传递到详细信息视图控制器?对此有什么建议或快速修复吗?理想情况下,我想创建一个这样的方法:
[self performSegueWithIdentifier:@"showDetail" sender:self passObject:object];
原因是“准备继续”似乎只有在我在详细信息披露指示器之前按下单元格时才会被调用。我将如何创建像上面这样的方法来创建下面准备的效果?
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
id object = [_objects objectAtIndex:indexPath.row];
[[segue destinationViewController] setDetailItem:object];
}
我已经尝试像这样创建 UIStoryboardSegue 的子类,但遇到了两个问题。
@implementation masterToDetail
-(void)performSegueWithIdentifier:(NSString*)identifier sender:(id)sender passObject:(id)object{
[self.destinationViewController setDetailItem:object];
[self performSegueWithIdentifier:identifier sender:sender];
}
-(void)performSegueWithIdentifier:(NSString*)identifier sender:(id)sender{
//What code should go here? Issue one
}
-(void)perform{
//Second issue, the compiler will crash and say I need to override perform.
}