I am trying to create a custom UIView class which loads from a xim file that contains the interface for that view. I am trying to encapsulate the [NSBundle mainBundle] loadNibNamed...] within the init method of my custom view as follows:
- (id)init
{
self = [super init];
if (self)
{
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"LoadingV" owner:self options:nil];
self = [(LoadingV*)[nibViews objectAtIndex: 0] retain];
}
return self;
}
I want to know:
- Is this an acceptable way of doing so? And is there any better way?
- Should i keep the "retain" given that i do not call [self release] in dealloc?
Cheers AF