我创建自定义controllerView,但我希望看到没有编译。我如何预览结果?
例如,我的自定义控制器:
import Cocoa
class BreakWindowController: NSWindowController {
let breakViewController = BreakViewController()
var popoverManager: PopoverManager?
// MARK: View lifecycle
override func loadWindow() {
self.window = BreakWindow(contentRect: self.breakViewController.view.frame, styleMask: NSBorderlessWindowMask, backing: NSBackingStoreType.Buffered, defer: false)
self.window?.contentView = RoundedCornerView(frame: self.breakViewController.view.frame)
self.window?.center()
self.window?.animationBehavior = NSWindowAnimationBehavior.AlertPanel
self.window?.display()
self.window?.makeKeyWindow()
self.window?.makeMainWindow()
NSApp.activateIgnoringOtherApps(true)
self.window?.makeKeyAndOrderFront(true)
self.breakViewController.popoverManager = self.popoverManager
self.popoverManager?.breakController = self
(self.window?.contentView as! RoundedCornerView).visualEffectView.addSubview(self.breakViewController.view)
}
}
答案 0 :(得分:1)
你做不到。这是基于代码的视图的缺点。想一想,没有编译,xCode怎么知道视图是什么样的?