Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEric Hodgins
29,207 PointsWhy does increasing the time value in animationWithDuration do nothing when the keyboard is animating at the same time?
UIView.animateWithDuration(0.8) { self.textFieldBottomConstraint.constant = keyboardFrame.size.height + 10 self.view.layoutIfNeeded() }
Changing 0.8 to any other number doesn't seem to change anything.
1 Answer
Gavin Maxwell
3,521 PointsIf I change it to 5.0 I see a significant difference when the keyboard comes up - it jumps up quickly to initially get out of the way of the keyboard, but then takes the rest of the 5 seconds to settle into it's final resting place... if you're only changing by small amounts you're might not notice the difference, but 5.0 is clearly noticeable.
Hope this helps.
Eric Hodgins
29,207 PointsEric Hodgins
29,207 PointsThanks Gavin, I tried anything between 0 and 1000 and it made no difference. But if I trigger the animation separate from the keyboard notification method it works as expected. For example in viewDidAppear. But for some reason when the keyboard's animating and the textfield is animating it doesn't work they way I thought it would.