uiview's controls unresponsive.. or how to foul up a view hierarchy

Posted by user293139 on Stack Overflow See other posts from Stack Overflow or by user293139
Published on 2010-05-16T02:03:46Z Indexed on 2010/05/16 2:10 UTC
Read the original article Hit count: 297

Hello all,

I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller.

I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e.

view controller.view.subviews = configH, configV, and results. I then use the controller.view bringSubviewToFront to bring the either the configH, configV, or the result view to the front.

Rotation works-queue(humor intended) the angelic choirs... almost. What's happening is that my configV button's are responsive, but when the device (or simulator) is rotated, my configH controls are not. (configV is the second subview added, but the first one to be brought to the front because app comes up in portrait mode) The controls on the results view also work.

Plan B was to assign the controller.view to configH, configV, or results. All of my controls now work, but rotation is now fouled up.

Question 1: Is there a better way to do this? (a horizontal and vertical config view and a rotatable results view) Question 2: Does the above suggest a design issue, or is it more likely that my addled brain is just missing something in my own code. (nothing from the peanut gallery please)

many thanks!

© Stack Overflow or respective owner

Related posts about uiview

Related posts about screen-rotation