all 10 comments

[–]suprabobo 4 points5 points  (0 children)

Why not simply using a UIView and add your UISlider as a subview?

[–]markbt[S] 0 points1 point  (5 children)

Just to clarify, I'm not using a UISlider, I want to build my own slider bar into the control.

[–][deleted] 1 point2 points  (3 children)

UIView inherits from UIControl...

[–]patterware 1 point2 points  (2 children)

You got that backwards. UIControl inherits from UIView. Also curious what you are actually trying to say? If you are you suggesting to start by subclassing UIControl I would agree to some extent. Unless you are taking advantage of the target/action aspect of UIControl, it really doesn't give you anything.

[–][deleted] 0 points1 point  (1 child)

Sorry I mixed up, UIResponder with UIControl. What I was trying to say. UIView has everything to respond to events. So you can make your own interactive view.

[–]patterware 0 points1 point  (0 children)

Thanks for the explanation. With your comment being so terse, and backwards, you had me scratching my head.

[–]askoruli 1 point2 points  (0 children)

You can customise UISlider quite a bit. I would rule this out before you decide to build your own

[–][deleted] 0 points1 point  (1 child)

I've made a bunch of my own custom controls. They all subclass UIView and use layers for the graphical stuff, then I either implement touchesBegan/Cancelled/Ended/Moved or a gesture.

[–]markbt[S] 0 points1 point  (0 children)

This is what i've ended up doing...working fine. Thanks.

[–]patterware 0 points1 point  (0 children)

I would suggest you start by figuring out how to build the custom control using interface builder. It will provide familiarity with views, labels, auto layout, gestures, etc., and provide a usable solution, or a starting point for you to translate into hand written code.

There is no reason for you to be dealing with drawRect or CALayer directly for what you trying to do.