Basically I have a main screen that comes up with a background image and three menu choices across the bottom of the screen. When I add these 4 components to the RootViewController’s view, everything works fine., but if I do something like
_mainContainer = [[UIView alloc] init];
self.view = _mainContainer;
_firstScreen = [[UIView alloc] initWithFrame:self.view.frame];
"some code here setting up the subviews"
[buttonLeft addTarget:self action:@selector(startGame) forControlEvents:UIControlEventTouchUpInside];
[_firstScreen addSubview:mainMenuBackground];
[_firstScreen addSubview:buttonLeft];
[_firstScreen addSubview:buttonMid];
[_firstScreen addSubview:buttonRight];
[_mainContainer addSubview:_firstScreen];
Essentially if I add everything directly to _mainContainer, the buttons work, if I add it to _firstScreen, then add _firstScreen they don’t work.
User interaction is enabled on _firstScreen. I do something similar later in my app and it works fine. Also, not sure if this has anything to do with it, but despite my screen being displayed in landscape, and all options in the plist being set to landscape only, when I run a transition, like flipFromBottom (or whatever its called), my app thinks the “bottom” is with the screen being in portrait until I move to another group of subviews in my app. (So basically the title screen is acting screwy).
I looked everywhere for a solution, hopefully I am not missing something basic.
Hey what is mainMenuBackground?, if its a image , their is no need to make it as a subView, instead, the correct way is to set it as a background image. I hope this will solve your problem