我的应用程序通过霹雳到HDMI适配器在外部显示器上显示图像/视频。除了屏幕没有填充外,工作正常。有一些边缘框架,我无法弄清楚如何摆脱。它是相同的,大约50px,顶部,底部,左,右..这里是图像的代码:
func addImage(image: UIImage){
if UIScreen.screens().count > 1 {
let secondScreen = UIScreen.screens()[1]
secondWindow = UIWindow(frame: secondScreen.bounds)
print(secondScreen.bounds) // 1920x1080
//secondWindow?.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) // Tried.. no change
secondWindow?.screen = secondScreen
secondScreenView = UIView(frame: secondWindow!.frame)
//secondScreenView?.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) // Tried.. no change
secondWindow?.addSubview(secondScreenView!)
secondWindow?.hidden = false
externalImage = UIImageView(frame: secondScreen.bounds)
externalImage.contentMode = .ScaleAspectFit // Tried .ScaleAspectFill
externalImage.image = image
secondScreenView!.addSubview(externalImage)
}else{
noExternalDisplay()
}
}
答案 0 :(得分:0)
找到答案!!
secondScreen.overscanCompensation = UIScreenOverscanCompensation(rawValue: 3)!