1

我正在制作 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];
4

1 回答 1

2

标签栏不适合有 6 个按钮。它会将超过 4 个的额外按钮放入“其他”类别。

您应该使用自己的按钮创建自己的视图。你可以通过这种方式更好地“游戏化”它。只需在视图上为它们制作自定义按钮并为它们提供选择器目标。

于 2013-08-21T06:36:49.030 回答