Skip to content

Instantly share code, notes, and snippets.

@bdittmer
Created June 20, 2011 22:56
Show Gist options
  • Save bdittmer/1036804 to your computer and use it in GitHub Desktop.
Save bdittmer/1036804 to your computer and use it in GitHub Desktop.
@import <AppKit/AppKit.j>
@implementation WVNavigationViewController : CPViewController {
@outlet CPTableView navTableView;
@outlet CPView navItemView;
}
- (void)viewDidLoad {
[super viewDidLoad];
[[[navTableView tableColumns] objectAtIndex:0] setDataView:navItemView];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView {
return 2;
}
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(int)aColumn row:(int)aRow {
CPLog("tableView:objectValueForTableColumn");
if(aRow == 0) return { "name":"Welcome!" }; else return { "name":"User Insight" };
}
@end
@implementation WVNavItem : CPView {
@outlet CPImageView imageView;
@outlet CPTextField textField;
}
- (void)setObjectValue:(Object)object {
CPLog("setObjectValue: " + object.name);
[textField setStringValue:object.name];
}
- (id)initWithCoder(CPCoder)aCoder {
self = [super initWithCoder:aCoder];
imageView = [aCoder decodeObjectForKey:"imageView"];
textField = [aCoder decodeObjectForKey:"textField"];
return self;
}
- (void)encodeWithCoder:aCoder {
[super encodeWithCoder:aCoder];
[aCoder encodeObject:imageView forKey:"imageView"];
[aCoder encodeObject:textField forKey:"textField"];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment