Hi, in iPadOS Beta 13.1 the behavior of MTKViewDelegate.mtkView( MTKView , drawableSizeWillChange: CGSize ) is different to iOS 12.4 and earlier.
The following example code is called by the MTKView each time the view's drawable changes. The code is used by the iOS and the macOS version of my game.
class Delegate: MTKViewDelegate {
public func mtkView(_ view: MTKView, drawableSizeWillChange drawableSize: CGSize) {
// Print drawable size.
print.("\(drawableSize.width) x \(drawableSize.height)" )
}
}
- macOS
When the user resizes the MTKView this code prints the view's pixel size.
500 x 300
510 x 308
516 x 316
518 x 320
- iOS 12.4
During launch on an iPad mini 2,4,5 (I tested several devices). The game supports landscape mode only and requires fullscreen.
1536 x 2048
2048 x 1536
The delegate is called twice. The first time the drawable size is the size of the iPad's screen in portrait mode. Then the app changes to landscape mode (this is forced by iOS because I set the landscape mode flag in the info.plist) and the delegate is called again with the same dimensions yet in landscape mode. This means the dimensions are just flipped because the iPad's physical screen size didn't change.
So fare this is the behaviour I expected according to the documentation.
- iOS 13.1 Beta
During launch on an iPad mini 5.
1536 x 2048
2731 x 1152
Notice the second time – in landscape mode – the drawable size is different. The drawable size doesn't match the screen size. The width is larger than the screen and the height is to small.
Now my question: Is this a bug or a feature?
Do I need to enable something in iOS & iPadOS 13 to force the MTKView to use the native screen size in landscape mode?
Maybe an Apple engineer could help.
Thanks!