6
如何在Objective-C中定义和使用ENUM?
我在实现文件中声明了一个枚举,如下所示,并在我的接口中将该类型的变量声明为PlayerState thePlayerState;并在我的方法中使用了变量。但是我收到错误消息指出它是未声明的。如何在我的方法中正确声明和使用PlayerState类型的变量?: 在.m文件中 @implementation View1Controller typedef enum playerStateTypes { PLAYER_OFF, PLAYER_PLAYING, PLAYER_PAUSED } PlayerState; 在.h文件中: @interface View1Controller : UIViewController { PlayerState thePlayerState; 在.m文件中的某些方法中: -(void)doSomethin{ thePlayerState = PLAYER_OFF; }
180
iphone
objective-c
c