gpt4 book ai didi

iphone - 带有标签栏的半透明覆盖

转载 作者:行者123 更新时间:2023-11-29 10:56:08 28 4
gpt4 key购买 nike

我正在制作一个 iOS 游戏,对于我的游戏内暂停菜单,我想要一个覆盖窗口,底部有 6 个选项卡,用于 map 、设置等。整个 Pane 将略微透明,不会占用整个屏幕。

实现这个的最佳方法是什么?以编程方式创建六个按钮和窗口并在按下暂停按钮时将它们添加到 View 是否最简单?或者是否可以创建标签栏 + 窗口并调整 alpha?

编辑:我在点击暂停按钮时添加了自定义 View 和按钮:

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];

最佳答案

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

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

关于iphone - 带有标签栏的半透明覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18350357/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com