I have gone through many threads here and other blogs but not able to solve this issue. I have a added a subview in content view of window. Here is the storyboard--
I have dragged out outlet of customView to view controller and here is the code for view controller -
import Cocoa
import QuartzCore
class ViewController: NSViewController {
@IBOutlet weak var customView: NSView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.wantsLayer …Run Code Online (Sandbox Code Playgroud) 我经历了很多问题,但没有一个回答我的问题。我正在尝试以编程方式加载初始窗口 这是我所做的。
我添加了 main.swift as-
import Cocoa
private func runApplication(
application: NSApplication = NSApplication.sharedApplication(),
delegate: NSApplicationDelegate? = AppDelegate(),
bundle: NSBundle = NSBundle.mainBundle(),
nibName: String = "MainMenu",
var topLevelObjects: NSArray? = nil) {
setApplicationDelegate(application, delegate)
}
private func setApplicationDelegate(application: NSApplication, delegate: NSApplicationDelegate?) -> NSApplication {
if let delegate = delegate {
application.delegate = delegate
}
return application
}
runApplication()
Run Code Online (Sandbox Code Playgroud)
Appdelegate.swift 是-
import Cocoa
//@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var appControl:AppFlow?
func applicationDidFinishLaunching(aNotification: NSNotification) {
}
func applicationWillTerminate(aNotification: NSNotification) {
// …Run Code Online (Sandbox Code Playgroud) 我想要统一标题工具栏,就像日历应用程序没有标题.我试过跟踪 - 在viewDidLoad我添加了 -
self.view.window?.titleVisibility = .Hidden
Run Code Online (Sandbox Code Playgroud)
我在属性检查器中选择了统一标题和工具栏.
我还尝试在身份检查器中的用户定义的运行时属性中将titleVisibility添加到1.
我无法使用没有标题的工具栏实现统一标题.我错过了什么 感谢帮助.
这可能是一个非常微不足道的问题,但我无法弄清楚.我删除了一个窗口的标题栏 -
self.window?.styleMask = NSBorderlessWindowMask
self.window?.movableByWindowBackground = true
Run Code Online (Sandbox Code Playgroud)
现在任何文本字段都不起作用并被禁用,因为没有标题栏canBecomeKeyWindow设置为false.请参考这个
我怎么能把它设置为真?
我试过了
self.window?.makeKeyWindow()
Run Code Online (Sandbox Code Playgroud)
但它没有用.谢谢你的帮助.