Adding Integer To NSMutableArray

前端 未结 3 455
花落未央
花落未央 2021-01-04 05:49

I couldn\'t find this anywhere, so I am asking just asking to make sure. And yes, I know its basic, but I figure I\'d rather get that right before I make the mistake a mill

3条回答
  •  醉酒成梦
    2021-01-04 06:20

    As stated by the previous replies, you can only add objects (id type) to container classes like NSArray.

    One class that can be helpful in this context is NSValue, which serves as a container for non-object data types of C and objective-C. In addition to numerical data types, this can also contain structs and some objective-C primitive data types like NSRect.

    Look here for more details: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsvalue_Class/Reference/Reference.html

提交回复
热议问题