Upload
others
View
23
Download
0
Embed Size (px)
Citation preview
Animations with AL (and stack views)
Marin Todorov
Swift 2.0 Swift 2.0
UIView.animateWithDuration(1.0, animations: { redSquare.center.x = 200.0 })
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!
Demo…
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
AutoLayout
VC pushed VC popped
orientationchange
keyboardpops up
changeconstraint
AutoLayout
AutoLayout
AutoLayout
Internal & External changes
loadView()
UIView.animateWithDuration(1.0, animations: {
})
view.center.x += 10
view.center.x -= 10
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
UIView.animateWithDuration(1.0, animations: {
})
… code to change constraints…
layoutIfNeeded()
Demo…
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
Demo…