开发者

pass specific enum value to method in objective-c

Altough I already know it's not possible, as my understanding how programming works, I would like to have a confirmation of this.

I have an enum

typedef enum {
enum_first=1,
enum_second=2
} myenum

I wanted to do overloading of method, this syntax is obviously wrong, but it gives the idea:

-(id)myenumTest:(myenum.enum_first)value {...}

-(id)myenumTest:开发者_如何学运维(myenum.enum_second)value {...}

Can you suggest an alternative way for this ?

thanks Leonardo


I'd use a case statement within the method based on the value of the enum variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜