2016-02-16 21 views
0

我正在使用SplitViewController製作應用程序。SplitViewController打開新的細節視圖,而不是更新現有的(iPhone 6+)

當我使用我的應用程序在iPhone 6 Plus上的橫向模式(即拆分視圖,如在設置應用程序),我得到了(這是正常的):

screen2

但我當點擊一個單元格以更新與相應的圖像的細節視圖,我有一些奇怪的: screen3 另一個細節視圖從屏幕左側彈出。它應該用新圖像更新現有的詳細視圖。

你知道爲什麼會發生這種情況,以及如何獲得正確的行爲?也許我在故事板上做錯了什麼?

[編輯]:
這裏是我的prepareForSegue:

MY_Img *img = [self.imgs 
objectAtIndex:self.tableView.indexPathForSelectedRow.row]; 
/* 
DetailViewController *detailController = (DetailViewController *)segue.destinationViewController; 
[detailController setDetailItem:img]; 
*/ 

((AppDelegate*)[UIApplication sharedApplication].delegate).detailItem=img; 

我不得不因爲評論部分,使程序崩潰時使用的。我不知道爲什麼。你知道那是錯的嗎?

他們,我回來了img在DetailController與:

- (void)viewDidLoad { 
[super viewDidLoad]; 

[self setDetailItem: ((AppDelegate*)[UIApplication sharedApplication].delegate).detailItem]; 

} 
+0

這是我的故事板:[screen1](http://imgur.com/voVuZUa) – tourdetour

回答

0

從主表視圖的單元格中的SEGUE應該去包含詳細的ViewController導航控制器。

如果將您的代碼與Master-Detail模板中新創建的項目進行比較,可能會發現其他錯誤。

+0

謝謝,這是有道理的。我在主視圖控制器中的詳細視圖控制器中添加了我設置信息的代碼。 – tourdetour

相關問題