I have a custom UISlider that is relatively tough for big fingered people to grab hold of and slide due to the size of the "thumb image". Is there any way to increase the size of clickable / draggable area without altering the size of the image?
Here's the code I have for creating the custom slider if that helps:
[slider setMaximumTrackImage:[[UIImage imageNamed:@"max.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)]
forState:UIControlStateNormal];
[slider setMinimumTrackImage:[[UIImage imageNamed:@"min.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)]
forState:UIControlStateNormal];
[slider setThumbImage:[UIImage imageNamed:@"thumb.png"]
forState:UIControlStateNormal];
I ended up using this and it works pretty well for me.
Posted this answer, so that it could be helpful to someone.
I ended up subclassing the UISlider and overriding this method:
This extends the touchable area by 10 pixels on the left and right and 15 pixels on the top and bottom.
go with this link http://erfan-ali-31.blogspot.in/2011/10/more-sensitive-or-responsive-custom.html its working, tested in device also
Resize frame and change image alignment to desired one. You can make its alignment centred, left, right, top or bottom. Make it this way:
So your touching frame will be bigger and image scale will remain unchanged.
Also you can just increese image size which will lead to increasing of slider thumb size.
If you need to left image size not too big but adjust slider size just add transparent space around image content.
If you are using slider in UITableViewCell the problem also is that tableview handle gesture just before the slider. To change this use the following solution: https://stackoverflow.com/a/37751635/2150954 I think it is not too difficult to translate his code to Objective C.
This solution works with iOS 8:
Credits go to this post: http://www.mpatric.com/2009-04-15-more-responsive-sliders-on-the-iphone