gpt4 book ai didi

iphone - 关闭 iPhone 屏幕

转载 作者:行者123 更新时间:2023-12-03 20:58:14 29 4
gpt4 key购买 nike

我正在寻找一种方法来关闭 iPhone 屏幕而不让 iPhone 进入休眠状态。我真的不介意关闭屏幕是否违反苹果规则。将窗口 alpha 设置为 0 可以解决问题吗?我可以更改某种 boolean 值吗?

如果有人有想法,我们将不胜感激。

非常感谢,

斯图

最佳答案

首先使状态栏不可见:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

然后创建一个 subview ,背景颜色为黑色:

CGRect rect = [[UIScreen mainScreen] applicationFrame];
UIView *bg = [[UIView alloc] initWithFrame:rect];
bg.backgroundColor = [UIColor blackColor];
[window addSubview:bg];

首先隐藏状态栏的原因是,[[UIScreen mainScreen] applicationFrame] 调用将覆盖整个屏幕。

关于iphone - 关闭 iPhone 屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3380085/

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