views:

183

answers:

1

Hi,

I've been searching all over for an easy way to do this. Right now I have a UIScrollView setup as my main view. There's an Image on the left and a column of TextFields on the right. When any TextField is tapped, the keyboard comes up and hides the bottom TextField. So I have the ScrollView move up to unhide the bottom TextField.

Question #1: Is there a way to have it respond to a specific TextField instead of all of them?

Question #2: Is there a way to keep the Image on the left static so it doesn't move with the TextFields?

Thanks in advance for any help.

+1  A: 

Question #1:

You can use the UITextFieldDelegate method - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField to see if the last text field was the one that is being used. Then you can animate the scroll view upwards.

Question #2:

You have a couple options here. You could make the main view a UIView. Then add the UIScrollView as a subview and then add the UIImageView as another subview on top of the UIScrollView. Then when you move the scroll view, the image will stay in the same place. Another option is to use the UIScrollViewDelegate method of - (void)scrollViewDidScroll:(UIScrollView *)scrollView to animate the image downwards as the scroll view animates upwards or something similar.

rickharrison