18
Animations with AL (and stack views) Marin Todorov

Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

  • Upload
    others

  • View
    23

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Animations with AL (and stack views)

Marin Todorov

Page 2: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY
Page 3: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Swift 2.0 Swift 2.0

Page 4: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY
Page 5: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

UIView.animateWithDuration(1.0, animations: { redSquare.center.x = 200.0 })

Page 6: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Stack Overflow

Q: How to do this one animation thing in my app?

A: Include Bloated.framework by Super Awesome Ninja Dev and paste:

createANM().move().byX(20).byY(10).fadeWithTint().etc().etc()

Q: Accepted! Works!

Page 7: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY
Page 8: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Demo…

Page 9: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

AutoLayout

UIView1UIView2

Constraint Width Constraint Height

Constraint CenterX Constraint MarginY

Constraint Ratio Constraint Height

Constraint Vert. Space

Layout Hierarchy

UIView1.center UIView1.bounds UIView2.center UIView2.bounds

UIView1.height = UIView2.height * 0.5 + 100

Page 10: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

AutoLayout

VC pushed VC popped

orientationchange

keyboardpops up

changeconstraint

AutoLayout

AutoLayout

AutoLayout

Internal & External changes

loadView()

Page 11: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

UIView.animateWithDuration(1.0, animations: {

})

view.center.x += 10

view.center.x -= 10

Page 12: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

AutoLayout

UIView1UIView2

Constraint Width Constraint Height

Constraint CenterX Constraint MarginY

Constraint Ratio Constraint Height

Constraint Vert. Space

Layout Hierarchy

UIView1.center UIView1.bounds UIView2.center UIView2.bounds

UIView1.height = UIView2.height * 0.5 + 100

Page 13: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

UIView.animateWithDuration(1.0, animations: {

})

… code to change constraints…

layoutIfNeeded()

Page 14: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Demo…

Page 15: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

UIStackView

Button

Constraint Width Constraint Height

Constraint CenterX Constraint MarginY

Constraint Ratio Constraint Height

Constraint Vert. Space

AutoLayout

Text

horizontal/vertical centered

margin space

consult prev. slides

Page 16: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Demo…

Page 17: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY

Marin Todorov

Thank you!

www.underplot.com

Page 18: Animations with AL (and stack views)gotocon.com/dl/goto-cph-2015/slides/MarinTodorov_I... · UIStackView Button Constraint Width Constraint Height Constraint CenterX Constraint MarginY