如何解决SwiftUI macOS悬停在Button更改光标鼠标上
我有一个Button
,如下面的代码所示,我希望当鼠标经过Button
时,光标会发生变化,就好像它可以单击一样。
有这样的东西吗?
版本:
macOs: 10.15.4
Xcode: 11.7
代码:
Button(action: { ... }) {
ImageMac(systemName: "heart")
}.buttonStyle(PlainButtonStyle())
AppDelegate:
import Cocoa
import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject,NSApplicationDelegate {
var window: NSWindow!
var popover = NSPopover.init()
var statusBar: StatusBarController?
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
popover.contentViewController = MainViewController()
popover.contentSize = NSSize(width: 360,height: 360)
popover.contentViewController?.view = NSHostingView(rootView: contentView)
// Create the Status Bar Item with the Popover
statusBar = StatusBarController.init(popover)
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。