是否有可能在运行时获取枚举定义的项目总数?
虽然它和这个问题几乎是同一个问题,但这个问题与C#有关,据我所知,提供的方法在Objective-C中不起作用.
c enums objective-c
我为我的iPhone应用程序创建了一个typedef枚举...
typedef enum { FirstType, SecondType, ThirdType } type;
仅仅为了测试,我希望能够从这些中选择随机类型.
我打算用来arc4random() % 4做它,只是在它的位置使用int,但想检查是否有更好的方法来做到这一点.
arc4random() % 4
iphone enums typedef ios
enums ×2
c ×1
ios ×1
iphone ×1
objective-c ×1
typedef ×1