2013-10-01 42 views
0

我有我使用CoreData來填充我的tableViewCell的應用程序。在那個CoreData中,我有一個具有4個字符串屬性和一個Date屬性的實體。 可以通過此Date屬性來排列我的表格單元格嗎?通過創建日期排列tableViewCell日期

我試圖在這裏和youtube上搜索一些手冊,但不成功。

+0

看看https://developer.apple.com/library/ios/documentation/CoreData/Reference/NSFetchedResultsController_Class/Reference/Reference.html,這是你所需要的東西 –

回答

1

爲您的提取添加排序描述符。例如

fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"<name_of_date_property" ascending:YES]]; 
+0

非常感謝你:) – Mayo323

+0

有可能實現兩個按鈕到我的tableView將切換此描述符?例如在Date屬性和我的一個String屬性之間?也許通過(if)語句? – Mayo323