Search code examples
iosuitextfieldorientationautoresizeinputview

Custom input views: how to prevent them from fading during orientation change?


I am having trouble with assigning a UIControl subclass I made as a text field's inputView.
It shows - as expected - when the text field becomes firstResponder and hides when it resigns it firstResponder status.

However, the thing I am having trouble with is handling different orientations:
I set an autoresizingMask to the control's subviews so that there is a smooth transition when changing its width.
The thing is, they appear to be ignored as soon as I set it as the inputView. When enabling the simulator slow-motion animations via triple-hitting shift, you can see very clearly that the view fades between the two states.
This is not what I want. Firstly it looks odd, and secondly this does not fit my needs. Since the inputView contains a UIScrollView-like element, it would stop its deceleration animation during the fade.

Now my question is: Is there a way to prevent the fade from happening? I would really like to use the inputView property since it saves me from writing lots of lines of code.
Also, is it possible to specify different heights for different orientations?
Here are two demo projects showing how it is and how I want it to be.

Thanks in advance.


Solution

  • Until today I have found no way to prevent them from fading.