i'm trying display annotations building entrances on mapkit map in application.
to have created class entranceannotation
implementing mkannotation
can later implement custom mkannotationview
these. purpose of question though i'm experiencing problem when trying solve simple mkpointannotation
s.
i using custom subclass of mkmapview
inside of following code resides.
let entranceannotations: [mkpointannotation] = selectedbuilding.entrances.map { entrance in let ann = mkpointannotation() ann.coordinate = entrance.location return ann } addannotations(entranceannotations)
if check mapview
s list of annotations before , after calling addannotations
on it, can see added ones appearing in list.
i not have view(for annotation: mkannotation) -> mkannotationview?
overridden, shouldn't necessary simple mkpointannotation
s. if do, , return new instances of mkpinannotationview
given color, seems have no effect. whatever i'm doing, these annotations not appearing on map.
is there missing here? trying add single simple new annotation fails have effect.
let annotation = mkpointannotation() annotation.coordinate = cllocationcoordinate2d(latitude: 51.028500, longitude: 13.728653) addannotation(annotation)
if makes difference, trying run on ios 10 beta 14a5309d xcode 8 beta 3.
i ran myself. custom subclass of mkannotationview
relied on initialization done in override of initwithframe:
, ios 10, initializing annotationview calling initwithannotation:reuseidentifier:
call down initwithframe:. starting in ios 10, though, initwithframe:
never called. result of custom annotations had frame of (0, 0, 0, 0)
, did not display. adding
[self setframe:cgrectmake(0, 0, somewidth, someheight];
inside initwithannotation:reuseidentifier:
made annotations appear again under ios10. requires work map equivalent swift solution, issue. set breakpoints in initializers , see one(s) hit!
Comments
Post a Comment