NSCollectionView Sample Code -by ZophtX-
Hi. i got back into programming.. i had a vacation and kinda of a lazy summer. but i on my way back to Objective-C / Cocoa Programming i just about figured out how to use the NSCollectionView Class. ^.^
i did follow a guide but all it did is help me figure out the bindings on how the collection view works.
the CollectionView Guide URL is : [ here ]
the project that i uploaded is the Sample Code but it is not finished it still needs some work but i was just doing this to test and figure out how the NSCollection Works so it basically like a Fun Project on how things works. but i you all can use it as a NSCollectionView Reference.
Hope this Helps Somebody!!
Attachment: ViewDrawing.zip (38.0KB)
i fixed the NSLog issue that is in the attachment... here the code snippet on how i fixed it
Controller.h
@interface Controller : NSObject {
--- Outlets and MArrays HERE ----
NSUInteger mAmount;
}
Controller.m
-(IBAction) addPersonModelfromButton:(NSButton *)abutton {
PersonModel *model = [[PersonModel alloc] init];
model.name = [name_t stringValue];
model.occupation = [occupation_t stringValue];
[tempArray addObject:model];
[self setCollectionArray:tempArray];
if ([abutton state] == NSOnState || NSOffState || NSMixedState) {
mAmount++;
NSLog(@"New model added [Model Amount: %i]", mAmount);
}
}
-(IBAction) removePersonModelfromButton:(NSButton *)abutton {
[tempArray removeLastObject];
[self setCollectionArray:tempArray];
if ([abutton state] == NSOnState || NSOffState || NSMixedState) {
mAmount--;
NSLog(@"New model removed [Model Amount: %i]", mAmount);
}
}