开发者

NSArrayController subclass setFetchLimit in fetchWithRequest

开发者 https://www.devze.com 2023-03-18 07:48 出处:网络
I have a NSPopupButton that is bound to a CoreData backed NSArrayController. I subclassed the NSArrayController to set a fetchLimit and SortDescriptor.

I have a NSPopupButton that is bound to a CoreData backed NSArrayController.

I subclassed the NSArrayController to set a fetchLimit and SortDescriptor.

The problem is the following:

The FetchLimit only applies on the initial load. When entries are added to the CoreData Store programatically, the NSPopupButton reflects and shows the new entries, but does not apply the fetch limit. I also tried to set the merge: parameter to NO, but this开发者_StackOverflow中文版 doesn't seem to affect the updates/refetches.

- (BOOL) fetchWithRequest:(NSFetchRequest *)fetchRequest 
                    merge:(BOOL)merge 
                    error:(NSError **)error
{

    if(fetchRequest)
        [fetchRequest setFetchLimit:10];

    NSLog(@"fetchWithRequest: %@", fetchRequest);
    return [super fetchWithRequest:fetchRequest merge:NO error:error];
}

am i missing something?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号