Flip NSWindow objective-c / cocoa coordinate system

How can I flip the NSWindow coordinate system? I know that it has a Content View, but how can I flip the coordinate system of this particular view, which is of type NSView?

In a subview of my NSWindow Content View, I flip the coordinate system by subclassing NSView by placing this in my window, and in this subclass of NSView I implement the isFlipped method to return YES. Don't know how I could NSWindow make it view the contents of "MyFlippedSubclassedNSView"

+3
source share
2 answers

You cannot change the NSWindow internal coordinate system. The closest you can get is to flip the view as content.

Most likely, you really do not need inverted content or a window. What are you actually trying to accomplish by flipping the coordinate system?

I don’t know how I could NSWindow do this view of the contents of "MyFlippedSubclassedNSView"

Do it. Create an instance of MyFlippedSubclassedNSView and set it as the content view.

It is even easier to do this in IB: select a view of the contents of the window, click ⌘6 (Identity) and set the view class to MyFlippedSubclassedNSView.

+7
source

Sounds like you want to -[NSView setBoundsOrigin:].

0
source

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


All Articles