NSImage sliced in Xcode's Asset Catalog doesn't respect flippedness of a view

A view defined like this:

class SlicedKittyView: NSView {
    override func draw(_ dirtyRect: NSRect) {
        super.draw(dirtyRect)
        NSImage(named: "SlicedKitty")?.draw(in: bounds, from: NSZeroRect, operation: .sourceOver, fraction: 1.0, respectFlipped: true, hints: nil)
    }

    override var isFlipped: Bool {
        return true
    }
}

will always draw an image sliced in Xcode's asset catalog upside down as if respectFlipped is ignored.

Removing the slicing in Xcode produces the expected behavior: image is appropriately flipped.


Is it expected and if so how to make NSImage's drawing to respect view's flippedness?


(filed as 45378703)

Replies

Yep, I noticed the same thing. You can use AppKit functions NSDrawThreePartImage and NSDrawNinePartImage in code instead.