gpt4 book ai didi

ios - 带模糊的 UITabBar - Storyboard

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:50:12 54 4
gpt4 key购买 nike

使用 Storyboard 时如何在 UITabBarController 上实现模糊效果? enter image description here

这就是现在的样子 enter image description here

最佳答案

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 中,为 backgroundImage 和 shadowImage 设置清晰图像。然后将新的 UIVisualEffectView 和颜色 mask View 作为第一个 subview 插入到标签栏。

UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;

[[UITabBar appearance] setBackgroundImage:[UIImage new]];
[[UITabBar appearance] setShadowImage:[UIImage new]];

UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, tabBar.bounds.size.height)];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
[blurView setEffect:blurEffect];

UIView *maskView = [[UIView alloc] initWithFrame:blurView.frame];
maskView.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:0.5];
[blurView addSubview:maskView];

[tabBar insertSubview:blurView atIndex:0];

关于ios - 带模糊的 UITabBar - Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24670511/

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