mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
Added support to nib2cib for specifying the "Nib Name" property of the View Controller palette to enable view controller initialization from cibs.
This commit is contained in:
committed by
Ross Boucher
parent
228e801c91
commit
25634a66cb
@@ -166,14 +166,15 @@
|
||||
|
||||
|
||||
var CPViewControllerViewKey = @"CPViewControllerViewKey",
|
||||
CPViewControllerTitleKey = @"CPViewControllerTitleKey";
|
||||
CPViewControllerTitleKey = @"CPViewControllerTitleKey",
|
||||
CPViewControllerCibNameKey = @"CPViewControllerCibNameKey";
|
||||
|
||||
@implementation CPViewController (CPCoding)
|
||||
|
||||
/*!
|
||||
Initializes the view item by unarchiving data from a coder.
|
||||
Initializes the view controller by unarchiving data from a coder.
|
||||
@param aCoder the coder from which the data will be unarchived
|
||||
@return the initialized collection view item
|
||||
@return the initialized view controller
|
||||
*/
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
@@ -183,19 +184,23 @@ var CPViewControllerViewKey = @"CPViewControllerViewKey",
|
||||
{
|
||||
_view = [aCoder decodeObjectForKey:CPViewControllerViewKey];
|
||||
_title = [aCoder decodeObjectForKey:CPViewControllerTitleKey];
|
||||
_cibName = [aCoder decodeObjectForKey:CPViewControllerCibNameKey];
|
||||
_cibBundle = [CPBundle mainBundle];
|
||||
_cibExternalNameTable = [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Archives the colletion view item to the provided coder.
|
||||
@param aCoder the coder to which the view item should be archived
|
||||
Archives the view controller to the provided coder.
|
||||
@param aCoder the coder to which the view controller should be archived
|
||||
*/
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_cibName forKey:CPViewControllerCibNameKey];
|
||||
[aCoder encodeObject:_view forKey:CPViewControllerViewKey];
|
||||
[aCoder encodeObject:_title forKey:CPViewControllerTitleKey];
|
||||
}
|
||||
|
||||
@@ -27,14 +27,17 @@
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [super NS_initWithCoder:aCoder];
|
||||
self = [super NS_initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
_cibName = [aCoder decodeObjectForKey:@"NSNibName"];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSViewController : CPViewController
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user