Reputation: 659
I want to create a really thick horizontally oriented UISlider
. I know it is easy to make it longer, but how do I make the track (and therefore the area in which touch events can be registered) thicker?
Upvotes: 2
Views: 3746
Reputation: 18878
Swift equivalent of Michael's answer:
import UIKit
class ThickSlider: UISlider {
override func trackRect(forBounds bounds: CGRect) -> CGRect {
return bounds
}
}
Upvotes: 1
Reputation: 89509
Subclass the UISlider and then make this modification:
- (CGRect)trackRectForBounds:(CGRect)bounds
{
return bounds;
}
(I just tried this out in UICatalog -- which is a very nice set of Apple sample code -- and it works perfectly great).
Upvotes: 9