开发者

NSArrayController subclass setFetchLimit in fetchWithRequest

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜