Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. let originalImage = UIImage(named: "markerIcon")
  2.  
  3. delay(seconds: 0.05) { () -> () in
  4. marker.icon = self.newImageWithWidth(originalImage!, width: originalImage!.size.width/2, height: originalImage!.size.height)
  5. delay(seconds: 0.05, { () -> () in
  6. marker.icon = self.newImageWithWidth(originalImage!, width: 0.1, height: originalImage!.size.height)
  7. delay(seconds: 0.05, { () -> () in
  8. marker.icon = self.newImageWithWidth(originalImage!, width: originalImage!.size.width/2, height: originalImage!.size.height)
  9. delay(seconds: 0.05, { () -> () in
  10. marker.icon = self.newImageWithWidth(originalImage!, width: originalImage!.size.width, height: originalImage!.size.height)
  11. })
  12. })
  13. })
  14. }
  15.  
  16. func newImageWithWidth(image: UIImage, width: CGFloat, height: CGFloat) -> UIImage{
  17. let imageSize = CGSize(width: width, height: height)
  18. UIGraphicsBeginImageContext(imageSize)
  19.  
  20. let imageRect = CGRectMake(0, 0, width, height)
  21. image.drawInRect(imageRect)
  22.  
  23. let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
  24. UIGraphicsEndImageContext()
  25.  
  26. return resizedImage
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement