ios - Processing annotations from XML feed -
hee all,
at moment i'm working on reading locations (valid) xml feed.
<locations> <location> <title>supercoop</title> <category>supermarkt</category> <adres>something</adres> <latitude>52.8982342</latitude> <longitude>5.2449449</longitude> </location> <location> <title>thuis</title> <category>home</category> <adres>something</adres> <latitude>52.223482</latitude> <longitude>5.248282</longitude> </location> </locations>
"no real data in example"
i use touchxml parsing , works fine.
my question is: preferred way of processing information mkannotation.
i thought making object, example: mylocation , store there, have walk trough lots of mylocation objects.
secondly want object / annotation accessible when use "calloutaccessorycontroltapped" method can access more information stored in annotation when goes detailview example.
i hope , think guys can me out! thanks!
rolf
not sure mean "have walk through lots of mylocation objects" 1 way or other, have create object conforms mkannotation
protocol , add map.
you can either call addannotation
parse each location or, better, add annotations nsmutablearray , call addannotations
add them map in 1 shot.
if don't want create own class , using ios 4+, can use pre-defined mkpointannotation
class. gives properties title, subtitle, , coordinate you'd have squeeze title, category, , adres in there somehow.
it's not hard create own class implements mkannotation , add custom properties. better trying cram properties mkpointannotation. however, not use example provided in mapcallouts sample app (it implies have create separate class each unique coordinate). instead, create settable coordinate property.
in calloutaccessorycontroltapped
method, annotation object accessible using view.annotation
, can cast custom class , access properties easily.
for sample code, try these other answers:
Comments
Post a Comment