RSully/RSColorPicker — Issue #5: Completely fails with Interface Builder
Author: adamgit
Created: 2012-03-01 22:53:45+00:00
State: open

Apple broke their own rules when writing UIKit - you have assumed they will call the method:

initWithFrame:

...which they are required to. However, Apple never ever calls this method when NIB files exist.

Also, your implementation requires the frame to exist - but Apple does not provide a valid frame when loading from NIB.

So:

1. move all the code from initWithFrame into a new method - e.g. "initInternal"
2. initWithFrame should call [self initInternal];
3. add an -(void) awakeFromNib method, which should also (only) call [self initInternal];

If you do this, it works fine. If you don't, it will never work in a project that uses NIBs.