设置NSInteger的最大值

时间:2013-08-13 09:08:51

标签: iphone xcode ipad max nsinteger

* 很抱歉,如果之前已发布,但我现在已经找了30分钟而且找不到任何东西 *

嗨,我有一个名为currentcoins的NSInteger,我希望硬币的最大值为999.我已尝试过所有内容,包括

#undef NSIntegerMax
#define NSIntegerMax 999

但NSInteger没有注意到这一点。 有没有人有任何解决方案? (我正在为iOS做这个)

提前致谢。

1 个答案:

答案 0 :(得分:3)

您永远不应该重新定义像NSIntegerMax这样的系统定义。 这是由您为(32或64位)构建应用程序的系统类型设置的。

只需定义自己的最大值:

#define kMaxCoins 999
相关问题