Try This Code:
#define kTextFieldMovementDistance 150.0 //You can set this according to your need
#define kMinimumMovementDuration 0.3f
- (void) slidingViewUpward: (BOOL) isSlidingUp
{
CGFloat movementDistance = kTextFieldMovementDistance;
const float movementDuration = kMinimumMovementDuration;
int movement = (isSlidingUp ? -movementDistance : movementDistance);
[UIView beginAnimations: @"animation" context: nil];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: movementDuration];
self.view.frame = CGRectOffset(self.view.frame, 0, movement);
[UIView commitAnimations];
}
When you want to slide the view in upwards Direction, or when the Keyboard became the first responder, the pass the bool value as YES
otherwise NO
.