如何让 UISlider 变厚? [英] How to make UISlider thicker?

查看:26
本文介绍了如何让 UISlider 变厚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个非常厚的水平方向UISlider.我知道让它变长很容易,但是我如何使轨迹(以及可以注册触摸事件的区域)变厚?

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?

推荐答案

将 UISlider 子类化,然后进行以下修改:

Subclass the UISlider and then make this modification:

- (CGRect)trackRectForBounds:(CGRect)bounds
{
    return bounds;
}

(我刚刚在 UICatalog -- 这是一组非常好的 Apple 示例代码 -- 并且效果很好).

(I just tried this out in UICatalog -- which is a very nice set of Apple sample code -- and it works perfectly great).

这篇关于如何让 UISlider 变厚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆