Custom UISlider - Increase “hot spot” size

前端 未结 6 755
时光说笑
时光说笑 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:15

    Resize frame and change image alignment to desired one. You can make its alignment centred, left, right, top or bottom. Make it this way:

    CGRect newFrame = sliderHandle.frame;
    CGRectSetWidth(newFrame, 80);
    CGRectSetHeight(newFrame, 80);
    [sliderHandle setFrame:newFrame];
    [sliderHandle setContentMode:UIViewContentModeCenter];
    

    So your touching frame will be bigger and image scale will remain unchanged.

提交回复
热议问题