1

I am using PaintCode to create a button. I import the StyleKit, and create the NSButton Class for my RankView button. Like this:

import Cocoa

@IBDesignable
class RankView: NSButton {

    override func drawRect(dirtyRect: NSRect) {
        super.drawRect(dirtyRect)
        StyleKit.drawRank2()

        // Drawing code here.
    }

}

But when I run the app, (and even in the storyboard), the button is upside-down. Like this: enter image description here

The arrow should be Up, but it points down.

Whenever I change the parent class to NSView it displays properly. Any ideas why this is happening/how to fix it?

Aaron
  • 1,312
  • 3
  • 14
  • 25

1 Answers1

1

NSButton uses flipped coordinates by default (its isFlipped method returns YES).

To support these kinds of views, change the origin of the canvas in PaintCode like this:

enter image description here

Aaron
  • 1,312
  • 3
  • 14
  • 25