我在我的应用程序中编写了以下代码:
typedef enum{
PasswordModeEnter = 1,
PasswordModeSetNewPassword = 3,
passwordModeVerify = 5,
PasswordModeChange = 7,
PasswordModeDisabled = 9
}PasswordModes;
我实例化了一个名为 PasswordMode 的对象。
- (id)initWithPasswordMode:(PasswordModes *)passwordMode nibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.PasswordMode = passwordMode;
}
return self;
}
我在编写以下代码时遇到了一个奇怪的错误:
switch (self.PasswordMode) {
case PasswordModeChange:
//do something
break;
case PasswordModeDisabled:
//do something
break;
case PasswordModeEnter:
//do something
break;
case PasswordModeSetNewPassword:
//do something
break;
case passwordModeVerify:
//do something
break;
default:
break;
}
我收到以下错误:
语句需要整数类型的表达式。
有什么问题,我该如何解决?