I have a custom object with two 2D arrays as follows:
float a[5][5];
float b[5][10];
And I want to encode this object:
- (void)encodeWithCoder:(NSCoder *)coder
{
// Encode a
// Encode b
}
How can I encode and decode these 2D arrays? I couldn’t find an appropriate method to do this operation.
Thanks in Advance,
You can create a struct with those:
Then use NSValue to encode them as objects.
Now, you can treat your struct as an object and use then with NSArrays and so on.
To read the values you can use:
I did it like this to work with streams and legacy servers and it worked smoothly.
Hope it helps.