Lefora Free Forum
login join
Loading
850 views

NSCollectionView Sample Code -by ZophtX-

Page 1
1–3
novice - member
25 posts



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)

novice - member
25 posts


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);


}


}



?
288 posts

Thanks for posting this.  Somebody asked earlier this year about this class - maybe it was you?  Anyway, thanks for posting and sharing.  Much appreciated.

__________________
Page 1
1–3

Locked Topic


You must be a member to post in this forum

Join Now!