I have a little problem with uitextfield & uiscrollview, the problem is that when I click on uitextfield the keyboard hide the field, for solve this I use:
- (BOOL) textFieldShouldBeginEditing:(UITextField *)textField {
CGRect viewFrame = self.scroll.frame;
viewFrame.size.height -= 186;
[self.scroll setFrame:viewFrame];
return YES;
}
- (BOOL) textFieldShouldReturn:(UITextField *)textField{
[self.scroll setFrame:CGRectMake(0, 0, 320, 480)];
[self inserisciField];
[textField resignFirstResponder];
return YES;
}
and all work, the problem is with multiple field, with a field selected if I change the field without click return the scroll view has a wrong size/positon but if I click return, then I Select a field, press return, change field, ecc...all work.
I think that there is this problem because If I change field the scroll dimension was changed two time (the first time view frame.size.height -= 186, and another time with -=186) then I try to put this method
- (BOOL) textFieldShouldEndEditing:(UITextField *)textField {
[self.scroll setFrame:CGRectMake(0, 0, 320, 480)];
return YES;
}
where I set the default size of frame, but nothing.