开发者

Problem with NSMutableArray?

i initialize instance variables in .h file,

NSInteger saveValue0, saveValue1, saveValue2, saveValue3;

NSMutableArray *nodeArray;

Now in .m file, in viewWillAppear event,

saveValue0 = 0; 
saveValue1 = 2; 
saveValue2 = 3;
saveValue3 = 0;

nodeArray = [[NSMutableArray alloc] initWithObjects:saveValue0, saveValue1, saveValue2, saveValue3, nil]; 

But above variable does not inserted in the array. When i trying to see the objects in array using break point, it gives me 0 objects present in nodeArray. Why it will give me 0 obj开发者_StackOverflowects. Any reason behind that?


NSInteger is not an object, and you can only store objects in arrays. Use [NSNumber numberWithInteger:0] etc.


NSInteger is just a standard C type.U cannot add those into NSMutableArray

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜