[英]iOS / Core Data - How can I change sectionNameKeyPath of a NSFetchedResultsController?
我像這樣聲明了我的fetchedResultsController
NSFetchedResultsController *fetchController = [[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext
sectionNameKeyPath:@"date" cacheName:nil];
但是當我點擊UISegmentedControl時,我想將sectionNameKeyPath更改為@“title”。
你知道這樣做的方法嗎?
謝謝
您需要重新定義FRC並重新啟動獲取請求。 在類上設置屬性以保存當前sectionNameKeyPath的值(在viewDidLoad事件中設置默認值),或者可以將其傳遞給實例化並執行FRC的方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.