I have a UIView and I initialize it from a nib file.
In my nib file I dragged and dropped a UIImageView and I changed the class name to MyImage.
When i load the view it doesn't seem like it's initializing the the image using my custom class, because the init method is not getting called. Any idea what the problem is?
@interface MyView : UIView
@property (nonatomic, retain) IBOutlet MyImage *image;
@end
@implementation MyView
@synthesize image;
- (id)init
{
self = [super initWithNibName:@"MyView" bundle:nibBundleOrNil];
return self;
}
@end
Here is MyImage Here is my Image
@interface MyImage : UIImageView
@end
@implementation MyImage
- (id)init
{
// This doesn't get called
self = [super init];
if (self)
{
// do somethin
}
return self;
}
@end
UIView
haveinitWithNibName: bundle
initializer? as you've used it in your code snippet. – anonim