我想通过prepareForSegue函数中的segue传递数据,但我一直在获取exc_bad_access。prepareForSegue EXC_BAD_ACCESS at indexPath.row
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
//NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"itemListSegue"])
{
itemList *vc = [segue destinationViewController];
vc.inv = [inv_list objectAtIndex:indexPath.row];
vc.title = vc.inv;
}
}
波纹管是我得到了错误
编辑: inv_list声明如下:
@interface downloadInv(){
NSMutableArray *inv_list;
}
在viewDidLoad中:
inv_list = [[NSMutableArray alloc] init];
内容:
vc.inv是在inv_list特定元件,我想当选择一个表,传递到目的地视图控制器。
它被宣布如下:
@interface itemList : UITableViewController
@property(nonatomic, strong) NSString *inv;
@end
任何人都知道如何解决这一问题?
在此先感谢。
什么是inv_list?它是数组吗?确保你在'prepareforsegue'中获得了正确的indexpat而不是零! – Lion
请说明如何定义inv_list? –
向我们展示列表是什么,以及您尝试填充的vc属性是什么。 –