Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么UISwitch onImage/offImage属性在iOS 7上不起作用?_Ios_Objective C_Xcode_Uiswitch - Fatal编程技术网

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

为什么UISwitch onImage/offImage属性在iOS 7上不起作用?,ios,objective-c,xcode,uiswitch,Ios,Objective C,Xcode,Uiswitch,拥有这两个选项/属性并弃用它们有什么意义 来自苹果文档: 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 content

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

来自苹果文档:

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

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

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

是的,您需要UIButton来模拟该效果。@Piyuesh,这些属性会被弃用吗?如果您不能自定义UISwitch,那么现在使用UISwitch有什么意义?是否可以通过创建子类使其在iOS 7上工作?Thx.我还没有为此尝试过子类。