2013-03-19 46 views
0

我使用的是用故事板和TableView中plist文件,使用此來源:準備賽格瑞兼容的指針

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 

    if ([@"detailList" isEqual:segue.identifier]) { 

     NSIndexPath *index = [self.tableView indexPathForCell:sender]; 
     DetailViewController *detail = [_saved objectAtIndex:index.row]; 
     [[segue destinationViewController] setSaved:detail]; 
    } 
} 

和工作,如果我在桌子上敲擊SEGUE告訴我正確的內容,但在行:

[[segue destinationViewController] setSaved:detail]; 

我提醒說:

不兼容的指針TY PES發送 「DetailViewController * __強」到類型的參數「的NSMutableArray *」

我有修復做的,刪除此提醒?

感謝名單

+0

是如何'setSaved:'方法聲明? – Adam 2013-03-19 11:15:27

+0

你確定細節實際上是一個DetailViewController *?這將意味着_saved是一個DetailViewControllers數組?這看起來不正確。 – 2013-03-19 11:18:36

+0

在DetailViewController中,我在模式中使用了SAVED:「@property(nonatomic,strong)NSDictionary * saved;」並在TableViewController中這樣:「@property(nonatomic,strong)NSMutableArray * saved;」 – BlackSheep 2013-03-19 11:33:09

回答

0

您發送可變對象(從NSMutableArray)到不可變對象(NSDictionary

@property (nonatomic, strong) NSDictionary *saved; 

這裏的NSDictionary是不可改變的,您是從NSMutableArray(其可變)發送對象。

只是讓這樣的可變字典

@property (nonatomic, strong) NSMutableDictionary *saved; 
+0

改變它,但仍然繼續在「NSMutableDictionary」相同的allert noe T_T – BlackSheep 2013-03-19 12:26:11

+0

你有沒有嘗試過DetailViewController * detail =(DetailViewController *)[_ saved objectAtIndex:index.row]; – Rajneesh071 2013-12-16 08:00:45