iosnsarraymapkitmkcoordinatespan

iOS: Objectifying MKCoordinateSpan to put in an array


Im trying to find a direct way to put MKCoordinateSpan into an array without breaking it down to lat and long and store it in an NSArray. Not sure if there is such way.


Solution

  • Try this:

    MKCoordinateSpan currentSpan;
    currentSpan = ...; // Set the span to somethinf
    NSValue *spanVal = [NSValue valueWithBytes:&currentSpan objCType:@encode(MKCoordinateSpan)];
    ...
    MKCoordinateSpan currentSpanBack;
    [spanVal getValue:&currentSpanBack];