gpt4 book ai didi

ios - 将 subview 添加到外部屏幕(iOS5)

转载 作者:行者123 更新时间:2023-11-28 17:41:35 25 4
gpt4 key购买 nike

我有一个 View Controller ,称为 TVOutViewController (.h & .m),它应该处理我的外部屏幕。我如何“告诉” View Controller 这样做?

我已经做了什么:

NSLog(@"Current Number of screens: %i", [[UIScreen screens] count]);


if([[UIScreen screens]count] > 1) {

CGSize maxSize;
UIScreenMode *maxScreenMode;

for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
{
UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
if(current.size.width > maxSize.width)
{
maxSize = current.size;
maxScreenMode = current;
}
}
UIScreen *externalScreen = [[UIScreen screens] objectAtIndex:1];
externalScreen.currentMode = maxScreenMode;

所以现在我的数组中有一个外部屏幕(并且已识别)。但是我如何向这个屏幕添加(例如)标签?

有没有这样的方法:

 Screen Handled by the TVOutViewController = TheExternalScreen //Pseudocode
[Screen Handled by the TVOutViewController addSubview: aLabel]; //Pseudocode

谢谢!

最佳答案

明白了。 UIWindow 必须全局定义!

关于ios - 将 subview 添加到外部屏幕(iOS5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7938456/

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