mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-10-07 09:33:28 +00:00
NSViewController loading from nib
This commit is contained in:
parent
4b8373dca0
commit
b7656a9e0e
@ -11,6 +11,18 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
-initWithCoder:(NSCoder *)coder {
|
||||
if([coder allowsKeyedCoding]){
|
||||
_nibName=[[coder decodeObjectForKey:@"NSNibName"] copy];
|
||||
_title=[[coder decodeObjectForKey:@"NSTitle"] copy];
|
||||
NSString *bundleIdentifier=[coder decodeObjectForKey:@"NSNibBundleIdentifier"];
|
||||
if(bundleIdentifier!=nil)
|
||||
_nibBundle=[NSBundle bundleWithIdentifier:bundleIdentifier];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSString *)nibName {
|
||||
return _nibName;
|
||||
}
|
||||
@ -56,6 +68,12 @@
|
||||
NSString *name=[self nibName];
|
||||
NSBundle *bundle=[self nibBundle];
|
||||
|
||||
if(name==nil){
|
||||
// should pathForResource assert name for non-nil?
|
||||
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] nibName is nil",isa,_cmd];
|
||||
return;
|
||||
}
|
||||
|
||||
if(bundle==nil)
|
||||
bundle=[NSBundle mainBundle];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user