Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Designing Delightful User Experiences with UIKit Dynamics

Designing Delightful User Experiences with UIKit Dynamics

Odecee Brownbag, April 15

Stephanie Sharp

April 29, 2015
Tweet

More Decks by Stephanie Sharp

Other Decks in Programming

Transcript

  1. 1. Emotional Design 2. Prototyping in Keynote 3. Intro to

    UIKit Dynamics 4. UIKit Dynamics with auto layout Outline
  2. Resources Prototyping: Fake It Till You Make It
 WWDC 2014

    Session 223 Tools and Tips for Prototyping Apps
 /dev/world/2014 (YouTube) Prototyping Animation with Keynote
 https://robots.thoughtbot.com/animating-with-keynote
  3. Physics inspired animation & interaction system Made to be composable,

    combinable, reusable Does not replace Core Animation or UIView animation What is UIKit Dynamics?
  4. Resources Getting Started with UIKit Dynamics
 WWDC 2013 Session 206

    Advanced Techniques with UIKit Dynamics
 WWDC 2013 Session 221
  5. Setting up constraints Add low priority height constraint on chart

    view Constrain smileys to bottom when animation stops
  6. Add vertical constraint - (void)addBottomConstraintToSmiley { // ... NSDictionary *views

    = NSDictionaryOfVariableBindings(centerView); NSString *visualFormatString = [NSString stringWithFormat:@"V:[centerView]-%lu-|", (unsigned long)self.verticalSpacing]; [self.referenceView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:visualFormatString options:0 metrics:nil views:views]]; [self.referenceView setNeedsLayout]; }
  7. Auto layout state It’s OK for auto layout to be

    in an invalid state while animator is active… But it must be valid before the next layout pass.
  8. self.questionLabel.text = kQuestionForChart; [UIView animateWithDuration:duration animations:^{ self.questionLabel.alpha = 0.0f; }

    completion:^(BOOL finished) { self.questionLabel.text = kQuestionForChart; [UIView animateWithDuration:duration animations:^{ self.questionLabel.alpha = 1.0f; }]; }]; Example
  9. Warning: Intrinsic content size Beware of views with an intrinsic

    content size
 (e.g. labels, buttons) Easy to inadvertently trigger a layout pass…
  10. “For views that are aware of Auto Layout, in most

    circumstances you want translatesAutoresizingMaskIntoConstraints to be NO. …this translation would prevent a button from automatically assuming its optimal width when its title is changed.” https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AdoptingAutoLayout/AdoptingAutoLayout.html