How to store enum values in a NSMutableArray

前端 未结 6 1196
故里飘歌
故里飘歌 2021-02-06 22:58

My problem is since an enum in objective-c essentially is an int value, I am not able to store it in a NSMutableArray. Apparently NSMutableArray won\'t

6条回答
  •  遥遥无期
    2021-02-06 23:12

    To go with NSNumber should be the right way normally. In some cases it can be useful to use them as NSString so in this case you could use this line of code:

    [@(MyEnum) stringValue];
    

提交回复
热议问题