Re: Weird printing and Core Data crash
Re: Weird printing and Core Data crash
- Subject: Re: Weird printing and Core Data crash
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 13 Mar 2006 15:51:35 -0800
On Mar 13, 2006, at 2:34 PM, Andrew Merenbach wrote:
- (NSArray *)combinedContentsArray {
NSMutableArray *rowStrings = [[NSMutableArray allocWithZone:[self
zone]] init];
NSEnumerator *e = [[self arrangedObjects] objectEnumerator];
id proxyObj;
while (proxyObj = [e nextObject])
[rowStrings addObject:[proxyObj valueForKey:@"contents"]];
return [rowStrings autorelease];
}
[...]
The enumerated entities in the array controller all contain a
"contents" string attribute.
- (NSArray *)combinedContentsArray
{
return [self valueForKeyPath:@"arrangedObjects.contents"];
}
(This gives you an array that contains an NSNull if contents is
actually nil. If you want to strip these out, then it would be
interesting so see which is faster, performing your own iteration or:
- (NSArray *)combinedContentsArray
{
static NSPredicate *predicate;
if (predicate == nil) {
predicate = [[NSPredicate predicateWithFormat:@"self != nil"] retain];
}
NSArray *contentsArray = [self
valueForKeyPath:@"arrangedObjects.contents"];
return, [contentsArray filteredArrayUsingPredicate:predicate]);
}
)
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden