Hi
What's the standard/recommended way to set the MTKView's drawableSize to a size lower than the view/window and, at the same time, be able to update the drawableSize whenever the app's window is resized?
Thanks
Hi wasintw, MTKView
provides drawableSize
and preferredDrawableSize
properties. Setting drawableSize
on MTKView
will trigger drawableSizeChanged
to be called. Therefor, you would need to set autoResizeDrawable
to false
if you want to use a custom drawableSize
.
When autoResizeDrawable
is set to false
on MTKView
, preferredDrawableSize
will still be updated. The preferredDrawableSize
property can be observed using a Key-Value observer to determine whether the window was resized. We have a Swift article that explains how to set up a Key-Value observer.