Quote:
Originally Posted by TelTikky
Since MKMapPoint is not an NSobject , can't use addObject to append additional.
|
You can't store a MKMapPoint directly. You have a number of choices as to how to save your MapPoint objects:
1.
Define a custom subclass of NSObject (lets call it MapPointObject) that has an MKMapPoint as a property. Create a convenience class method MapPointOjbectWithMapPoint: that takes an MKMapPoint as input, and returns an autoreleased MapPointOjbect.
You could then use code like this:
[myArray addObject: [MapPointPObject MapPointObjectWithMapPoint: theMapPoint]
2. Create an NSValue object to hold your map points and save NSValue objects to your array. Search on "Using Values" in the XCode docs for a system guide of the same name that shows how to use NSValues to hold structs. The example is almost exactly what you want (that example saves a struct with 2 floats. In your case you want a struct with 2 doubles.)