1
我知道这是非常基本的,但经过大量重构后,我仍然有点困惑。如何从UIView控制器加载视图?澄清需要
我有一个在故事板的帮助下创建的场景。当点击主菜单屏幕上的按钮时,应加载GameView
。
GameView
具有控制GameViewController
当程序运行时,GameViewController被称为,反过来
- (void) viewWillAppear:(BOOL)animated {
[self setGameView:[[GameView alloc] initWithFrame
:CGRectMake(0, 0, 300, 480)]];
[self setView:[self gameView]];
[self loadView];
}
但是什么显示在模拟器上,是不是GameView
,而是一个实物模型通过创建故事板。
我在想什么?
我也试过在UIViewController
以下无济于事
UIView *gameView = [[GameView alloc] initWithFrame:CGRectMake(0, 0, 300, 480)];
[[[self view] superview] addSubview:gameView];