Custom UISlider - Increase “hot spot” size

前端 未结 6 739
时光说笑
时光说笑 2020-12-08 08:21

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

6条回答
  •  囚心锁ツ
    2020-12-08 09:10

    I ended up subclassing the UISlider and overriding this method:

    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent*)event {
        CGRect bounds = self.bounds;
        bounds = CGRectInset(bounds, -10, -15);
        return CGRectContainsPoint(bounds, point);
    }
    

    This extends the touchable area by 10 pixels on the left and right and 15 pixels on the top and bottom.

提交回复
热议问题