I've been struggling with this for a while.
As we all probably know, the Lightning HDMI adapter doesn't support 1080p output when it comes to apps that use connected display as second screen (the only way to reach 1080p is video streaming but unfortunately is not my case).
The max output resolution is 1600x900, which could be good in my case, but I absolutely need to get rid of the "black frame" around my window and I can't figure out how to do it. The only way I've been able to do that was to manually stretch the TV output image in the TV menu, but as you may probably imagine is not a viable solution for my final product.
I've tried
secondScreen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame | UIScreenOverscanCompensationInsetBounds;
with no luck: my problem is not "overscan", is "underscan" and I'm afraid that the OS cannot be aware of the high resolution of the tv if the adapter is saying that 1600x900 is the highest.
If I connect my MacBookPro to the same TV and force a 1600x900 in monitor settings, somehow the whole screen is correctly resized to cover the full physical area of the TV with less definition and without the black frame. I'd like to know if there's a similar option to set in the iOS ecosystem.
I've also tried to force the output to 720p with something like this
for (UIScreenMode* mode in secondScreen.availableModes) {
NSLog(@"%f %f",mode.size.width,mode.size.height);
if (mode.size.height == 720) {
secondScreen.currentMode = mode;
}
}
since you can't create a UIScreenMode manually, but it's still using 1600x900. And everything is really hard to debug since lightning adapters don't have data connection (only charging), so I can't use XCODE debug at all...
I also have tried with AirPlay and VGA Adapter, 1080p works like a charm but for various reasons I need to use HDMI. iOS8 didn't fix this issue unfortunately
Does anyone have a really good idea to suggest? Thank you all.
UPDATE 1:
I've also discovered that VGA adapter could give you troubles when you're connecting an old monitor/tv with 1080p support but with no (for example) HDMI input (I know it's not related to VGA, I'm just trying to explain how old this monitor was even if provided 1920x1080 resolution. It was a SHARP plasma TV in a customer stand, don't know the right model).
When connected to the iPad Air with VGA adapter, output was 1024x768 and the console logged out something like "unable to identify screen UUID". I've also tried with the HDMI cable (since the monitor didn't have a HDMI input, I had to use a HDMI -> DVI adapter on monitor's end), but all I've got was usual 1600x900.
However, i was able to solve the problem, but I still cannot explain WHY this worked: I plugged the lightning-to-HDMI adapter in the ipad, then i connected a HDMI-to-VGA adapter (not related to Apple at all), then into the monitor with a VGA long cable. 1920x1080 like a charm.
This shouldn't be possible (I've got in some way full hd resolution through a HDMI/lightning adapter, which can only output 1600x900 max), but it worked, give it a try if you are REALLY in trouble like I was.
Also, note that result WILL vary with different TV/monitors/screens. That's completely unreliable.
Simply attach the Lightning Digital AV Adapter to the Lightning connector on your device and then to your TV or projector via an HDMI cable (sold separately).
if you are trying to get rid of the under scan/ borders then i suggest you scale the overscan compensation as shown in the code below. I have tested it using a lightening to hdmi cable it works well on external displays without the borders. Hope this helps. cheers
sample code:
if UIScreen.screens.count > 1 {
let secondScreen = UIScreen.screens[1]
secondScreen.overscanCompensation = UIScreenOverscanCompensation(rawValue: UIScreenOverscanCompensation.scale.rawValue.advanced(by: 2))!
secondWindow = UIWindow(frame: secondScreen.bounds)
secondWindow?.screen = secondScreen
secondWindow?.isHidden = false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With