PDA

View Full Version : UIView initWithFrame: not called when using nib




CarlosH
Jan 23, 2009, 10:53 PM
I usually dont use nibs, but I want to do a view using only nib, but also need to do some drawing on code. Everything works fine, except that the initFromFrame: method is never called withing the view. Do I need to add something?



xsmasher
Jan 24, 2009, 02:32 AM
I usually dont use nibs, but I want to do a view using only nib, but also need to do some drawing on code. Everything works fine, except that the initFromFrame: method is never called withing the view. Do I need to add something?

Yes, initWithCoder is called instead. Change your initWithFrame to initWithCoder; it expects an NSCoder instead of a frame, though.

CarlosH
Jan 24, 2009, 10:52 AM
Yes, initWithCoder is called instead. Change your initWithFrame to initWithCoder; it expects an NSCoder instead of a frame, though.

Thanks. That's what I needed.