【发布时间】:2012-07-05 13:34:40
【问题描述】:
基本上我有一个主屏幕,屏幕底部有一个背景图像和三个菜单选项。当我将这 4 个组件添加到 RootViewController 的视图中时,一切正常。但是如果我执行类似的操作
_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];
基本上,如果我将所有内容直接添加到 _mainContainer,按钮就可以工作,如果我将它添加到 _firstScreen,然后添加 _firstScreen,它们就不起作用。
在 _firstScreen 上启用了用户交互。我稍后在我的应用程序中做了类似的事情,它工作正常。另外,不确定这是否与它有关,但是尽管我的屏幕以横向显示,并且 plist 中的所有选项都设置为仅横向,但当我运行转换时,例如 FlipFromBottom(或其他任何名称),我的应用程序认为“底部”是屏幕处于纵向状态,直到我移动到应用程序中的另一组子视图。 (所以基本上标题屏幕表现得很糟糕)。
我到处寻找解决方案,希望我没有遗漏一些基本的东西。
【问题讨论】:
标签: objective-c ios uiview uiviewcontroller uibutton