我正在制作 iOS 游戏,对于我的游戏内暂停菜单,我想要一个覆盖窗口,底部有 6 个选项卡,用于地图、设置等。整个窗格将略微透明,不会占据整个屏幕.
实现这一点的最佳方法是什么?以编程方式创建六个按钮和窗口并在按下暂停按钮时将它们添加到视图中是否最简单?还是可以创建一个标签栏+窗口并调整alpha?
编辑:当点击暂停按钮时,我添加了一个自定义视图和按钮:
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Pause Layer_t" ofType:@"png"]]];
backgroundView.frame = CGRectMake(0, 0, 568, 320);
backgroundView.alpha = 0.8;
[self.view addSubview:backgroundView];
playButton = [UIButton buttonWithType:UIButtonTypeCustom];
[playButton addTarget:self
action:@selector(backToGame)
forControlEvents:UIControlEventTouchUpInside];
[playButton setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Play Button_Menu" ofType:@"png"]] forState:UIControlStateNormal];
playButton.frame = CGRectMake(0, 266, 90, 53);
[self.view addSubview: playButton];