views:

23

answers:

1

I have a sample project that uses the metrics from notifications for resizing the keyboard when a text field is focused.

http://www.smallsharptools.com/downloads/ObjC/KeyboardSize.zip

The series of text fields are all wrapped inside of a UIScrollView and when the keyboard is shown a notification is sent with the height value. I use that to decrease the height of the UIScrollView so that all of content can scroll inside without being covered by the keyboard.

But I find that when I do this the other text fields sometimes cannot be tapped. They seem to be covered with a layer that I cannot see.

What can I do to ensure that the input elements in the UIScrollView remain accessible when the height is changed?

FYI: You can see in the sample project there is a blue marker on top and another red one at the bottom. The view controller which handles the resizing is CMScrollingViewController which is inherited into KeyboardSizeViewController so that this behavior can be used by multiple view controllers.

I am hoping that this problem can be fixed so this simple code can be reused.

A: 

I figured out my problem. I was setting the view which goes inside scroll view to flex the height and width using the autoresizing mask. Once I commented out that line of code this problem went away. It seems it was resizing the view but I could still see the contents of the view but it was outside the bounds of the view so it could not respond to taps.

//self.subView.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
Brennan