hello,
I got stuck in here,
I have a custom scrollview in a view this scroll view has an add field button which lets user to add new text field to the scrollview. When user taps on a particular textfield keyboard appears and hide the textfield, to overcome this I followed UICatalog example, but it moves the whole scrollview up
to prevent this I followed UICatalog example and did this
-(void)textFieldDidBeginEditing:(UITextField *)sender
{
if (sender.frame.origin.y>109) {
moveScrollViewUpBy=(sender.frame.origin.y-109+10);
[self viewMovedUp:YES];
}
}
-(void)viewMovedUp:(BOOL)movedUp
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect rect = formScrollView.frame;
if (movedUp)
{
if(rect.origin.y == 0.0f){
rect.origin.y -= kOFFSET_FOR_KEYBOARD;
rect.size.height += kOFFSET_FOR_KEYBOARD;
}
}
else
{
if(rect.origin.y != 0.0f){
rect.origin.y += kOFFSET_FOR_KEYBOARD;
rect.size.height -= kOFFSET_FOR_KEYBOARD;
}
}
self.formScrollView = rect;
[UIView commitAnimations];
}
here
#define kOFFSET_FOR_KEYBOARD 160.0
but this shifts the scroll view up,
I want that when i tap on a textfield down below in scroll view... scroll view scrolls and that textfield appears....
is it possible to do so....otherwise suggest me some other solution
I have one more query srollview just stop scrolling while the keyboard stays on screen. Is there any way to overcome this