Hi I have created a custom annotation in Sketch 3 and when I scale it down to fit into the map view it becomes blurry. How do I fix this?
Asked
Active
Viewed 593 times
2 Answers
3
I was having trouble with this too. Maybe this might help other people though, as you seem to have found a suitable solution.
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let reuseId = "id"
var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView!.canShowCallout = true
}
else {
anView!.annotation = annotation
}
anView!.image = yourFullSizeImage
anView!.frame.size = CGSize(width: 50, height: 50) //Resize frame AFTER setting image, for me resizing frame first did not work
return anView
}

patrickd
- 275
- 3
- 14
-
Yeah I hade to use makeappicon.com to scale down my image. That was the only way I could do it – Trip Phillips Aug 09 '16 at 14:59
2
You could try to set the filtering Mode of your Node texture to .Nearest
let nodeTexture = SKTexture(imageNamed: "node")
nodeTexture.filteringMode = .Nearest
node = SKSpriteNode(texture: nodeTexture)

Devapploper
- 6,062
- 3
- 20
- 41
-
SKTexture and SKSpriteNode do not appear for me. Do I need to import any frameworks? – Trip Phillips Aug 12 '15 at 07:47
-
-
1I wasn't able to get what I what from your code , but I decided to go on www.makeappicon.com and I was able to use the scaled down icon that it made for the Apple Watch and now the image quality is very good. Thanks for the help – Trip Phillips Aug 12 '15 at 19:07