- I created a new Class named CustomToolbar
- Then i created an empty nib, added a toolbar to it, and set the toolbar class to "CustomToolbar".
What is the proper way of initializing CustomToolbar In code so that my class uses the nib file?
I already have written the code to do that but i know it's not the correct way and it has a leak.
@interface CustomToolbar : UIToolbar {
}
@property (nonatomic, retain) IBOutlet UIBarButtonItem *button;
@end
@implementation CustomToolbar
- (id)initWithDelegate
{
NSArray *objects = [[NSBundle mainBundle]
loadNibNamed:@"CustomToolbar"
owner:nil
options:nil];
if (self = (CustomToolbar*) [objects objectAtIndex:0])
{
//do some work here
}
return self;
}
@end