NSArrayController
NSArrayController
- Subject: NSArrayController
- From: David Piasecki <email@hidden>
- Date: Wed, 7 Dec 2005 16:50:23 -0800
Following an example, I used an NSArrayController and set bindings to
an NSTableView. The code below results in the desired output;
however, I received errors at runtime. I had a similar problem with
NSTreeController, but I'd like to get the NSArrayController working
first. The example code produces no errors.
2005-12-07 16:10:46.252 Raptor[13018] *** -[_NSControllerArrayProxy
firstIndex]: selector not recognized [self = 0x6fa1a0]
2005-12-07 16:10:46.376 Raptor[13018] *** -[_NSControllerArrayProxy
firstIndex]: selector not recognized [self = 0x6fa1a0]
- (void)LoadEventLog
{
LogMessageArray = [[NSMutableArray alloc] initWithCapacity:100];
for( int i = 0; i < 100; i++ )
{
NSMutableDictionary *LogDictionary = [[NSMutableDictionary alloc]
init];
[LogDictionary setObject:@"Testing" forKey:@"EventText"];
[LogDictionary setObject:[NSString localizedStringWithFormat:@"%d",
i] forKey:@"EventID"];
[LogDictionary setObject:@"My Date/Time" forKey:@"DateTime"];
[LogMessageArray addObject:LogDictionary];
}
[LogArrayController setContent:LogMessageArray];
}
The example code...
- (void) awakeFromNib
{
int theLoop;
theListing = [[NSMutableArray alloc] initWithCapacity:27];
for ( theLoop = 0; theLoop < 27; theLoop++ ) {
NSMutableDictionary* theEntry;
NSString* firstStr;
NSString* secondStr;
theEntry = [[NSMutableDictionary alloc] init];
firstStr = [NSString stringWithFormat:@"Row %d", theLoop+1];
[theEntry setObject:firstStr forKey:@"colOne"];
secondStr = [NSString stringWithFormat:@"Hidden pref #%d", theLoop+1];
[theEntry setObject:secondStr forKey:@"colTwo"];
[theListing addObject:theEntry];
}
[myController setContent:theListing];
}
_______________________________________________
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