I am programming for iOS, and using ARC.
I am trying to use a c-array as property, but it reports error.
@property (strong, nonatomic)NSString *mappingTable[70][254];
The error is "Property cannot have array or function type NSString *[70][254]"
. How can I solve this problem? How can I declare c-array as property?
Note:
This is a two dimensional array, I think it is much easier to just use c-array, so I didn't use NSArray for it.
Surprised this hasn't been suggested already but you can store the c-array in an NSData object. I just used this method to store an array of frames.
@property (nonatomic) NSData *framesArray;
// Create and initialize your c-style frames array
CGRect frames[numberOfFrames];
...
self.framesArray = [NSData dataWithBytes:frames length:(sizeof(CGRect) * numberOfFrames)];
// To Access the property
NSUInteger arraySize = [self.framesArray length] / sizeof(CGRect);
CGRect *frames = (CGRect *) [self.framesArray bytes];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With