0
如何使用NSMutableArray來準備ForSegue?如何準備使用NSMutableArraySeSegue?
NSMutableArray *theNews;
,這是prepareForSegue代碼
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSManagedObject *object = [[theNews objectAtIndex:indexPath.row] objectAtIndexPath:indexPath];
[[segue destinationViewController] setDetailItem:object];
}
}
如果我跑我得到這個錯誤代碼:
終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因是:「 - [__ NSDictionaryM objectAtIndexPath :]:無法識別的選擇器發送到實例0x81c0f40'
是你在線[[segue destinationViewController] setDetailItem:object];錯誤? – CRDave 2013-02-08 13:19:20
顯然這個新聞實際上是一本字典,而不是一個數組。你是在哪裏創造的? – 2013-02-08 13:21:33