gpt4 book ai didi

ios - 将 UIVisualEffectView 添加到 UITableView 的背景 View 仅适用于模拟器而非设备

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:41:54 25 4
gpt4 key购买 nike

我有一个 UITableView 和一个 UIImageView 作为 backgroundView。这就像一个魅力。但是,现在我试图模糊此图像(使用 UIVisualEffectView),以便 tableView 的背景看起来模糊。 但是,我的代码以某种方式忽略了图像并简单地模糊了表格 View 的白色背景。这是代码:

UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sidebarImage"]];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[blurEffectView setFrame:tempImageView.bounds];
[tempImageView addSubview:blurEffectView];
self.tableView.backgroundView = tempImageView;

编辑:经过更多测试后,我发现这在模拟器上有效,但在实际设备上无效。我在下面附上了截图。更令人惊讶的是,当我注释掉 [tempImageView addSubview:blurEffectView];图像出现。这意味着图像正在被复制到手机中。

Physical Phone

Simulator

最佳答案

这一定是我遇到的最愚蠢的问题之一。显然,我在我的 iPhone 设置中打开了“降低透明度”。因此问题。希望这能帮助其他一些试图节省电池的可怜人。

关于ios - 将 UIVisualEffectView 添加到 UITableView 的背景 View 仅适用于模拟器而非设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31161537/

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