我只想在外部显示器上全屏显示。
我正在使用这样的代码:
- (void) startTvOut {
NSArray *screens = [UIScreen screens];
CGSize max;
max.width = 0;
max.height = 0;
UIScreenMode *maxScreenMode = nil;
for (UIScreen *screen in screens)
{
if (screen != [UIScreen mainScreen])
{
for(int i = 0; i < [[screen availableModes] count]; i++)
{
UIScreenMode *current = [[screen availableModes] objectAtIndex: i];
if (current.size.width > max.width)
{
max = current.size;
maxScreenMode = current;
}
}
if (exWindow == nil)
{
exWindow = [[HUWindow alloc] initWithFrame:screen.brounds];
exWindow.backgroundColor = [UIColor whiteColor];
}
screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;
screen.currentMode = screen.preferredMode;
exWindow.screen = screen;
[exWindow makeKeyAndVisible];
m_isStarted = YES;
}
}
}
无法在外部设备上显示全屏。
我改变代码后
从
screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;
至
screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
它可以显示全屏,但点(0,0)不在左侧屏幕的顶部。
我的目标是以全屏显示屏幕并在屏幕的左上角显示点(0,0)。但它不起作用。
提前致谢
答案 0 :(得分:6)
更改此行:
screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;
到
screen.overscanCompensation = 3;
这是一个没有记录的价值......
答案 1 :(得分:0)
对我来说,以下代码解决了该问题(XCode 4,iOS 12.1)
screen.overscanCompensation = .scale
在添加此行之前,我遇到了问题,屏幕周围有黑框。