PaintCode NSButton 显示颠倒
PaintCode NSButton displays upside-down
我正在使用 PaintCode 创建一个按钮。我导入 StyleKit,并为我的 RankView 按钮创建 NSButton Class。像这样:
import Cocoa
@IBDesignable
class RankView: NSButton {
override func drawRect(dirtyRect: NSRect) {
super.drawRect(dirtyRect)
StyleKit.drawRank2()
// Drawing code here.
}
}
但是当我 运行 应用程序(甚至在故事板中)时,按钮是颠倒的。像这样:
箭头应该是向上的,但它指向下方。
每当我将父 class 更改为 NSView 时,它都会正确显示。知道为什么要 happening/how 修复它吗?
NSButton 默认使用翻转坐标(它的 isFlipped 方法 returns 是)。
要支持这些类型的视图,请像这样更改 PaintCode 中 canvas 的来源:
我正在使用 PaintCode 创建一个按钮。我导入 StyleKit,并为我的 RankView 按钮创建 NSButton Class。像这样:
import Cocoa
@IBDesignable
class RankView: NSButton {
override func drawRect(dirtyRect: NSRect) {
super.drawRect(dirtyRect)
StyleKit.drawRank2()
// Drawing code here.
}
}
但是当我 运行 应用程序(甚至在故事板中)时,按钮是颠倒的。像这样:
箭头应该是向上的,但它指向下方。
每当我将父 class 更改为 NSView 时,它都会正确显示。知道为什么要 happening/how 修复它吗?
NSButton 默认使用翻转坐标(它的 isFlipped 方法 returns 是)。
要支持这些类型的视图,请像这样更改 PaintCode 中 canvas 的来源: