为什么 UISwitch onImage/offImage 属性在 iOS 7 上不起作用?

And*_*mig 3 xcode objective-c uiswitch ios

拥有这两个选项/属性并弃用它们有什么意义?

来自苹果文档:

offImage
The image displayed while the switch is in the off position.

@property(nonatomic, retain) UIImage *offImage
Discussion
In iOS 7, this property has no effect.

In iOS 6, this image represents the interior contents of the switch. The image you specify is composited with the switch’s rounded bezel and thumb to create the final appearance.

Availability
Available in iOS 6.0 and later.
Declared In
UISwitch.h
Run Code Online (Sandbox Code Playgroud)

我现在该怎么办?用 UIButtons 替换所有 UISwitches?

rou*_*nak 6

使用 UIButton 的selected属性将其用作开关。为 UIButton 设置图像UIControlStateSelected并对其UIControlStateNormal进行自定义。