Duck
Duck

Reputation: 35953

iphone - Interface Builder not loading custom class?

I generally don't use Interface Builder (I hate it). But I am being forced to use it, because I was invited to a project where people are using it. I am trying to create a custom UISlider.

I have created a UISlider custom class, with my own images for the slider parts.

If I add a new object to my main code using

mySlider *one = [[mySlider alloc] initWithFrame:CGRectMake(0,0,60,30)];

I see the slider as I created, beautifully.

But if I use this class on interface builder, to change the appearance of a UISlider I create there, the slider continues to have the same appearance as before and when I run the app the interface shows the slider with the default appearance, not the one I designed.

I created the slider on IB, simply dragging a UISlider on the interface and changing its class to the one I've created. Is there something else that has to be done? Why is it not showing as defined on the custom class?

thanks

Upvotes: 4

Views: 1402

Answers (1)

Eiko
Eiko

Reputation: 25632

You need to implement the initWithCoder: initializer. initWithFrame: will not be called when a nib is loaded.

Upvotes: 7

Related Questions