我有一個帶有rootViewController tableview和detailView tableview的SplitViewController。在UISplitViewController中,當你在詳細視圖中刪除最後一個對象時,應該怎麼做
rootViewController包含的對象包含DetailViewController中的對象。如果rootViewController對象中沒有對象,則刪除rootViewController對象。
例如一個故事包含很多句子
如果您選擇了一個故事,並刪除了它在detailViewController中包含的最後一個句子 - 應該如何處理detailViewController?該故事已成功從rootviewcontroller中刪除,但我不確定在detailViewController中要做什麼。在iPhone特定的應用程序中,我只是將導航控制器從句子中彈出回到故事中,但是我不確定在detailViewController始終可見時應如何操作,因爲它與svc一樣。
我已經試過:
- 設置detailViewController爲空白的tableview
- 設置當前的故事對象爲空白
如果我選擇什麼都不做,我得到一個CoreData例外:
CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. attempt to insert row 7 into section 0, but there are only 1 rows in section 0 after the update with userInfo (null)
它可以處理一個空列表,因爲它在全新安裝中顯示一個空列表 - 但我不知道如何在刪除所有內容時將其重新設置爲空列表。 – glenstorey 2012-03-15 09:06:35
細節視圖控制器或主視圖控制器的某些部分的作用就好像總是會選擇某些東西,或者好像列表中始終有數據一樣。修正這個假設。 – Jesper 2012-03-15 11:53:51