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 m开发者_如何学Cy 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
You need to implement the initWithCoder:
initializer. initWithFrame:
will not be called when a nib is loaded.
精彩评论