Skip to content

Commit

Permalink
Added 'setNeedsLayout' and 'layoutIfNeeded' to animate the content #160
Browse files Browse the repository at this point in the history
  • Loading branch information
hackiftekhar committed Apr 20, 2015
1 parent b364276 commit b02b9e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IQKeyBoardManager/IQKeyboardManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ -(void)setRootViewFrame:(CGRect)frame
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
// Setting it's new frame
[controller.view setFrame:frame];

//Animating content (Bug ID: #160)
[controller.view setNeedsLayout];
[controller.view layoutIfNeeded];

_IQShowLog([NSString stringWithFormat:@"Set %@ frame to : %@",[controller _IQDescription],NSStringFromCGRect(frame)]);
} completion:NULL];
}
Expand Down Expand Up @@ -984,6 +989,11 @@ - (void)keyboardWillHide:(NSNotification*)aNotification
_IQShowLog([NSString stringWithFormat:@"Restoring %@ frame to : %@",[_rootViewController _IQDescription],NSStringFromCGRect(_topViewBeginRect)]);
// Setting it's new frame
[_rootViewController.view setFrame:_topViewBeginRect];

//Animating content (Bug ID: #160)
[_rootViewController.view setNeedsLayout];
[_rootViewController.view layoutIfNeeded];

} completion:NULL];
_rootViewController = nil;
}
Expand Down

0 comments on commit b02b9e2

Please sign in to comment.