Skip to content

Instantly share code, notes, and snippets.

@luvdamac
Created October 11, 2014 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luvdamac/de2e35ad0b0152c63a16 to your computer and use it in GitHub Desktop.
Save luvdamac/de2e35ad0b0152c63a16 to your computer and use it in GitHub Desktop.
Code exercise
func addLabels() {
myFirstLabel.text = "My first"
myFirstLabel.font = UIFont.systemFontOfSize(36)
myFirstLabel.sizeToFit()
myFirstLabel.center = CGPoint(x: 200, y: 240)
view.addSubview(myFirstLabel)
UIView.animateWithDuration(3.0, delay: 0.0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0.0, options: nil, animations: {
self.myFirstLabel.center = CGPoint(x: 200 - 100, y: 240)
}, completion: nil)
iPhoneLabel.text = "iPhone app!"
iPhoneLabel.font = UIFont.boldSystemFontOfSize(48)
iPhoneLabel.sizeToFit()
iPhoneLabel.center = CGPoint(x: 200, y: 300)
view.addSubview(iPhoneLabel)
iPhoneLabel.alpha = 0 // Hidden = 0
UIView.animateWithDuration(2.0, delay: 0.5, usingSpringWithDamping: 0.3, initialSpringVelocity: 0.0, options: nil, animations: {
self.iPhoneLabel.center = CGPoint(x: 200 - 20, y: 300)
self.iPhoneLabel.alpha = 1 // Visible = 1
}, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment