views:

1792

answers:

2

I have a NIB file with a UIView, a couple of UIImageView's (including a logo) and a UITableView inset within the UIView below the logo where I allow users to input a username/password to login to my application. I also have a third arbitrary UITextField within a UITableViewCell below the username/password. The problem is, when it is clicked, the keyboard covers the entire row.

I've used -scrollToRowAtIndexPath:atScrollPosition:animated: in other parts of my application successfully, but the difference there is my UITableView covered the entire height/width of the content view, so the scrolling worked. Here it doesn't scroll at all, and I'm going to guess because the UITableView is inset within the UIView.

Any suggestions on how to get the appropriate behavior would be much appreciated.

+3  A: 

Do you have enough content in the table view to overflow its bounding box? From your description, it sounds like you may not, in which case it wouldn't scroll.

Neil Mix
+2  A: 

I faced the same situation. It is suggested that you change the height of your view when the keyboard appears. The problem in the case you've described is, there is not enough content in the tableview to scroll up and still have something in the area hidden by the keyboard.

If you adjust the size of the tableview to be equal to 480-150 (height of view - height of keyboard), and use scrollToRowAtIndexPath, it will work as expected. Once the keyboard hides again, change back the height of the tableview to the original height.

lostInTransit