UITextField move up when keyboard appears in Swift : In swift language have minor change other thing have same -
Some textfield hide behind keyboard so how can we move view on textfield editing . So we can work on this ..
Here I have make a function for this , in this you can pass want view move then pass "true" and with your movement height
func textFieldDidBeginEditing(textField: UITextField) {animateViewMoving(true, moveValue: 100)}
func textFieldDidEndEditing(textField: UITextField) {animateViewMoving(false, moveValue: 100)}func animateViewMoving (up:Bool, moveValue :CGFloat){var movementDuration:NSTimeInterval = 0.3var movement:CGFloat = ( up ? -moveValue : moveValue)UIView.beginAnimations( "animateView", context: nil)UIView.setAnimationBeginsFromCurrentState(true)UIView.setAnimationDuration(movementDuration )self.view.frame = CGRectOffset(self.view.frame, 0, movement)UIView.commitAnimations()}
If you want do this same thing in objective-C then visit on this post Moving UIView up when UITextField is selected
Try this it will work fine , I have tested this ..
Thanks for Visit , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+
3 comments
Write commentsNice
ReplyI have passed my view outlet reference in animate view string nothing happened I have added top and bottom constraint to it.
Replywithin scrollview it will not work..Please help
Reply