Ell*_*eal 5 uisegmentedcontrol ios ios5 uiappearance
我正在使用UIAppearanceiOS 5中的新API来UISegmentedControl定制带有自定义图形的样式.我需要能够在执行期间设置一些段被禁用,但这些UIAppearance方法似乎不允许我为状态设置分频器图像UIControlStateDisabled.
我打电话给:
[[UISegmentedControl appearance] setDividerImage:disabledSelectedImage
forLeftSegmentState:UIControlStateDisabled
rightSegmentState:UIControlStateSelected
barMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
where disabledSelectedImage资源来自此资源的可调整大小的图像:

然而,当我将左段设置为disabled([UISegmentedControl setEnabled:forSegmentAtIndex:])时,结果如下:

您可以清楚地看到UISegmentedControl默认使用UIControlStateNormal- UIControlStateNormal分频器图像.
我很高兴使用设置背景图像 UIControlStateDisabled
[[UISegmentedControl appearance] setBackgroundImage:disabledImage
forState:UIControlStateDisabled
barMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
(并且在处于禁用状态时尊重我提供的图像)但不是分频器图像.有没有人遇到这个或找到解决方案?
| 归档时间: |
|
| 查看次数: |
2507 次 |
| 最近记录: |