Skip to content

Instantly share code, notes, and snippets.

@mousebird
Last active November 7, 2016 18:19
Show Gist options
  • Save mousebird/b1914f1833c39e137d4b90eec5c4a2d7 to your computer and use it in GitHub Desktop.
Save mousebird/b1914f1833c39e137d4b90eec5c4a2d7 to your computer and use it in GitHub Desktop.
Smiley Face Stickers
func addStickers (_ arrayComp: NSArray , baseViewC: MaplyBaseViewController) {
// Pick up a smiley face image
let startImage = UIImage(named: "Smiley_Face_Avatar_by_PixelTwist")
var stickers = [MaplySticker]()
// Add a sticker for each input point
for object in arrayComp {
let sticker = MaplySticker()
let center = (object as! MaplyVectorObject).center()
sticker.ll = center
sticker.ur = MaplyCoordinate(x: center.x + 0.1, y: center.y+0.1)
sticker.image = startImage
stickers.append(sticker)
}
// Add all the stickers at once. It'll draw faster
baseViewC.addStickers(stickers, desc: [kMaplyFade: (1.0)])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment