1
我有一個簡單的@IBDesignable
視圖,我已經指定爲我的macOS故事板中的場景的基類。例如,在Xcode 8中,Swift 3:IBDesignable視圖不渲染
@IBDesignable class OvalView: NSView {
@IBInspectable var strokeColor: NSColor = .black { didSet { needsDisplay = true } }
@IBInspectable var brushSize: CGFloat = 5.0 { didSet { needsDisplay = true } }
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
strokeColor.setStroke()
let path = NSBezierPath(ovalIn: NSInsetRect(bounds, brushSize/2, brushSize/2))
path.lineWidth = brushSize
path.stroke()
}
}
當我運行該應用程序時,此視圖顯示正常。但是這個可設計的視圖並沒有在我的場景中呈現在Interface Builder中。爲什麼?
這個問題也出現在Xcode 7.3.1中,上面的代碼也使用了Swift 2。
我收到了此錯誤報告與上一個錯誤報告重複的更新。所以,蘋果至少知道這個問題。 – Rob
這個錯誤似乎仍然存在於XCode 8.3 :( – Alnitak