我正在使用Xcode 5.0.2并在尝试编译我的目标C代码时收到以下警告:
**Implicit conversion from enumeration type 'enum UIControlEvents' to different enumeration type 'UIControlState' (aka 'enum UIControlState')**
警告位于abcLabel.m
:
[searchBtn setTitleColor:[UIColor whiteColor] forState:**UIControlEventTouchUpInside**];
答案 0 :(得分:0)
您应该使用UIControlState枚举,例如:
[searchBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
您可以选择的选项:
enum {
UIControlStateNormal = 0,
UIControlStateHighlighted = 1 << 0,
UIControlStateDisabled = 1 << 1,
UIControlStateSelected = 1 << 2,
UIControlStateApplication = 0x00FF0000,
UIControlStateReserved = 0xFF000000
};
当你想要向控件添加事件时,你应该使用 UIControlEvent
,例如按下按钮按钮。