Sunday, 8 September 2013

How to properly make a UIView work in Interface Builder

How to properly make a UIView work in Interface Builder

I have a custom view that I would like to use in Interface Builder. It's
setup like the following:
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self initialize];
}
return self;
}
-(void)initialize {
....
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initialize];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
...frame stuff
}
but when I use the class in interface builder it is not receiving the
frame, just it's bounds. Meaning the origin stays at 0,0 but the
width/height do get set correctly. If anyone can point out whats wrong I
would be very greatful.

No comments:

Post a Comment