MKAnnotation coordinate
MKAnnotation coordinate
- Subject: MKAnnotation coordinate
- From: Dan Hopwood <email@hidden>
- Date: Tue, 9 Nov 2010 09:31:07 +0000
Hi all,
This is a quick and simple question - for some ridiculous reason I can't
work out how it should be done properly and it couldn't be more frustrating.
I'd be really grateful if someone could help me out.
Ok so I am working with MKAnnotations on my map view and want to know the *
correct* (i.e. the Apple intended) way to set up my custom annotation class
so that I can set the coordinate upon initialisation but also access the
coordinate attribute from outside the class e.g. in my case I wish to do
something like:
region.center = myAnnotation.coordinate;
The above gives me an error and says the assignment is between incompatible
types.
I've done plenty of googling and have seen a few different solutions but
none of which seemed to allow me to access the coordinate. Some people
define a coordinate member variable and then @property/synthesize.
Others named the member variable _coordinate and then *just* synthesized it
(not @property) using @synthesize _coordinate = coordinate; - I don't fully
understand what that means. Finally (in the case of the MapCallouts source)
others have defined a function called coordinate that returns the
coordinate.
I believe the last option compiled but I get the error I mentioned above.
If someone could give tell me the correct solution by means of a really
simple example i.e. what should go in the .h and .m (I'm only interested in
the coordinate attribute for now) and then how to correctly access the
coordinate attribute from outside the class for assignment e.g. the center
attribute of the region object (sorry I can't remember the exact name).
Many thanks in advance,
Dan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden