枚举类型警告的隐式转换

时间:2013-04-01 17:58:26

标签: iphone xcode implicit-conversion uicontrolevents

Xcode现在在先前正常的代码行上抛出警告标志。

[_slider2 setThumbImage:thumbImage2Pressed forState:UIControlEventTouchDown];

发出警告:

“从枚举类型'枚举UIControlEvents'到不同枚举类型'UIControlStat'(又名'enum UIControlState')的隐式转换

怎么做??

1 个答案:

答案 0 :(得分:3)

UISlider方法:

- (void)setThumbImage:(UIImage *)image forState:(UIControlState)state;

接受forState UIConstrolState,而不是UIControlEvents

也许你可以试试这个:

[_slider2 setThumbImage:thumbImage2Pressed forState: UIControlStateNormal];

或其他UIControlState