Setting layout restrictions for UIWindow

Consider the following scenario: I have a subclass of UIWindow that displays a notification from above when a window is pressed down, very similar to what an incoming call does. At the moment, I am doing all this by setting a window frame that works well. However, since I am using AutoLayout in all new projects, I would also like to translate this UIWindow class to AutoLayout.

The following questions arise:

  • As a subclass of UIWindow is the key window, is there anything that I could bind the constraints, anyway?

  • Can I access the UIWindow restrictions that are automatically created using translatesAutoresizingMaskIntoConstraints ? self.constraints returns an empty array ...

So, in a nutshell: did someone manage to set layout restrictions for UIWindow (rather than a subspecies) with respect to the screen? Or is it just not possible, and I have to stick to programmatically setting frames?

+6
source share

Source: https://habr.com/ru/post/988226/


All Articles