<分区>
Possible Duplicate:
How to wrap a Struct into NSObject
Can the new Clang Objective-C literals be redirected to custom classes?
我有一个自定义结构:
typedef struct {
float f1;
float f2;
} MYCustomStruct;
我需要添加到 NSArray
。我已经编写了一个类别来创建这些结构的 NSValues
,然后我将其添加到 NSArray
,但是我想使用盒装表达式进一步简化它,如果可能的话。我希望能够做到这一点:
@[@(instanceOfMYCustomStruct)];
但是,我遇到了以下错误:
Illegal type 'MYCustomStruct' used in a boxed expression
有没有办法将装箱表达式与自定义结构一起使用?