Detecting unarchiving from IB
Detecting unarchiving from IB
- Subject: Detecting unarchiving from IB
- From: Gerard Iglesias <email@hidden>
- Date: Thu, 9 Aug 2001 20:37:21 +0200
For a long time I use this trick to detect that an object is unarchived
from a NIB file as a Custom class setting of paletised object :
//
**************************************************************************
***
- (id)initWithCoder:(NSCoder*)aCoder
{
self = [super initWithCoder:aCoder];
// if the class doesn't exist in the archive then we need to
completely initialize the instance, it means that we are unarchiving
from a Nib for example
if ([aCoder versionForClassName:@"GI3DKitView"] == NSNotFound){
// specific initialization
NSLog(@"GI3DKitView unarchiving specific initializing");
camera = [[G3DCamera alloc] initWithSize:[self frame].size];
}
return self;
}
And I am wondering if there is something less tricking?
Gerard