ios7 - gap between keyboard and textview during animation -


When I see the keyboard, I want to adjust the height of a text view. In iOS 7, this view can be done by adjusting the NSLayoutConstraint between the viewviews of the view controller and the down side of Layoutguide.

It works fine with the code below except for one description. During the animation, the text moves ahead of the keyboard and a wide difference is visible similar to the keyboard during the keyboard.

The reason for this "bug" is probably because the textView starts up high because the keyboard starts from the bottom of the screen due to the height of the toolbar.

Any suggestions on how to fix it?

  - (zero) keyboardWillShow: (NSNotification *) Notification {// Update Loss CGRect keyboardFrame = [[[notification userInfo] valueForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGRTT changed keyboardfram = [[see self] Change Convert: View from keyboardframe: zero]; CGRect ToolbarFrame = [[[Navigation Controller] toolbar] Frame]; CGTT Convert TollbarFrame = [[View Yourself] Convert: View from Toolbar Frame: Zero]; CGFloat toolbar adjustment = (UIInterfaceOrientationIsPortrait ([self interfaceOrientation]))? CGRextgetHeight (convertToolbarFrame): CGRCcatcity (convertToolbarFrame); [[_textView bottomSpaceConstraint] setConstant: CGRectGetHeight (convertedKeyboardFrame) - toolbarAdjustment]; // Change in animate (see UIView * [[Self View] in Subviews)) {[Set See Set-up Dated Consultants]; } [UIView animateWithDuration: [[[User information] valueForKey: UIKeyboardAnimationDurationUserInfoKey] doubleValue] Delay: 0 / 02.2 As possible hack, otherwise the difference between the keyboard and the text view options appears: [[[User information] ValueForKey: UIKeyboardAnimationCurveUserInfoKey] integerValue] Animation: ^ {For (UIView * [View of Self View] Subviews)) {[view layoutIfNeeded]; }} Completed: NULL];  

}

delay is probably due to calling LayoutIfNeeded Repeatedly in a loop

In the animation block, simply send layoutIfNeeded in root view, i.e., self.view . Send the code to the original view needs to be taken care of the entire sequence hierarchy, then get rid of the loop

I ask if setNeedsUpdateConstraints call Necessary; If this happens, it only needs to be sent in the root view

Also, try to delete the animation options parameter

 . 0  

Comments