How can I add custom subclasses of UIControl graphically in IB in Xcode 4?

I want to use the MHRotaryKnob Matthijs Hollemans control in my iOS 5 application. I use the storyboard in Xcode 4.2. MHRotaryKnobimplemented as a subclass UIControl.

I cannot reproduce the example that it provides, and thus could not add the control to my application. In this example, its XIB contains a view with an instance MHRotaryKnobadded to it as a custom control. It loads and works fine, but I don't see in Xcode any way to do this for myself. I tried to add all the subclasses UIControland change their class in the Identity Inspector, but Xcode continues to change them.

Any ideas?

thank

+5
source share
2 answers

The answer is to add a UIView to the view and change its class in the Identity Inspector, instead of trying to do this using buttons or other UIControls.

+9
source

When you change the UIView class from the Identity Inspector, be sure to add initWithCoder: aDecoder to your code in a custom class.

+1
source

All Articles