gpt4 book ai didi

ios - UIView 覆盖在带有 NavBar 和 TabBar 的 collectionViewController 上

转载 作者:行者123 更新时间:2023-11-29 00:25:50 28 4
gpt4 key购买 nike

我正在尝试在我的第二个 TabBarController 上创建一个显示“正在加载数据..”的 UIView 覆盖层,它没有覆盖我的导航栏和 TabBar。

我目前有这个作为我的代码

UIView *overlayView = [[UIView alloc] initWithFrame:self.navigationController.view.frame];

overlayView.backgroundColor = [UIColor blackColor];
overlayView.alpha = 0.4;
overlayView.tag = 88;

UILabel *message = [[UILabel alloc] initWithFrame:self.navigationController.view.frame];
[message setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:20.0f]];
message.text = @"Loading data...";
message.textColor = [UIColor whiteColor];
message.textAlignment = NSTextAlignmentCenter;
message.tag = 99;

[self.navigationController.view addSubview:overlayView];
[self.navigationController.view addSubview:message];

目前消息运行良好,但 UIView 覆盖层覆盖了我的 TabBar?你能帮我解决这个问题吗?

清除它:我想以编程方式显示一个 UIView 覆盖层,它不会覆盖 navBar 和 tabBar。

谢谢,干杯!

最佳答案

您需要在 ViewController 上添加您的 View ,这样它就不会覆盖 NavigationBarTabBar

[self.view addSubview:overlayView];
[self.view addSubview:message];

根据您当前的 View 设置框架。

希望这有助于覆盖全屏。

关于ios - UIView 覆盖在带有 NavBar 和 TabBar 的 collectionViewController 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43062479/

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