1

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.

Christian Schnorr
  • 10,768
  • 8
  • 48
  • 83

2 Answers2

0

You can create a method to your DatePicker class, that changes the geometry and layout of the view for different orientations and the implement the method

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

in your view controller and call the method on your view to align it.

graver
  • 15,183
  • 4
  • 46
  • 62
  • I guess you don't want to check those 10k lines. But I will create a demo project and share it here in some mins. – Christian Schnorr Apr 21 '12 at 09:36
  • Yes it would be great if you can reproduce the problem in demo project, because i couldn't. – graver Apr 21 '12 at 09:40
  • From what I saw in the demo, I think this is a normal behavior as the animation makes a smooth color transition from red (in portrait mode) to green (in landscape mode). I actually don't understand what's are you trying to achieve? No color animation or the contentView to fill the whole inputView in landscape? – graver Apr 21 '12 at 11:07
  • I want the view to be just resized and let the autoresizing masks take care of the rest. So the red should stay red and green borders should appear on both sides; but without fading. Try enabling the simulator slow-motion-animations and you will see that this is not what I want. – Christian Schnorr Apr 21 '12 at 11:15
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/10344/discussion-between-graver-and-jenox) – graver Apr 21 '12 at 11:16
0

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

Christian Schnorr
  • 10,768
  • 8
  • 48
  • 83