开发者

How to get integer from CCArray - cocos2d

i have a CCArray

    CCArray *indexs;

then i add a integer into it

    int x = 0;
    [indexs addObject:[NSNumber numberWithInteger:x]];

then i want to get this integer from this CCArray

    id temp1 = [indexs objectAtIndex:0];
    int firstOne = (int) temp1;

then i try using CCLOG

    CCLOG(@"%d", firstOne);

it shows a random number in the terminal, then i try

    CCLOG(@"%@", firstOne);

it shows 0 in the terminal, and i tried to pass firstOne into a function, firstOne's value is not 0, then how can i get a integer value from my CCArray? th开发者_StackOverflowank you


Code as,

int firstOne = [temp1 intValue];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜