First take these whole controls in UIScrollView
and set as it is,
after just in UITextView
delegate method textViewDidBeginEditing
set the frame of view like bellow...
-(void)textViewDidBeginEditing:(UITextView *)textView
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
yourScrollView.frame = CGRectMake(yourScrollView.frame.origin.x, -160, yourScrollView.frame.size.width, yourScrollView.frame.size.height);
[UIView commitAnimations];
}
and also set same like before after return like bellow...
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ([text isEqualToString:@"\n"])
{
[textView resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
yourScrollView.frame = CGRectMake(yourScrollView.frame.origin.x, 0, yourScrollView.frame.size.width, yourScrollView.frame.size.height);
[UIView commitAnimations];
return NO;
}
return YES;
}
you can also set the frame of UIView
instead of UIScrollView
..
Also first give the Delegate to UITextView
and add this delegate in .h
file
i hope this helpful to you...