V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
smartdone
V2EX  ›  iDev

[新手]macOS SwiftUI 鼠标悬浮提示应该怎么写

  •  
  •   smartdone · 2020-05-13 11:06:11 +08:00 · 6068 次点击
    这是一个创建于 1434 天前的主题,其中的信息可能已经有所发展或是发生改变。

    试了onHover,只能获取是否悬浮的状态,现在想要达到鼠标移动上去就显示一个提示。关于 macOS 开发的资料太少了,在官方文档里面没找到 demo

    7 条回复    2020-05-18 09:41:17 +08:00
    toooo
        1
    toooo  
       2020-05-13 11:20:28 +08:00
    SwiftUI 本身就是个新东西, 新的东西大概率没那么完善, 会有问题, 且现在主要精力肯定放在 iOS 平台的问题解决, 相对 macOS 不完善的地方肯定很多.
    尝鲜可以, 真要作为生产力 SwiftUI 用在 macOS, 还是不太建议的, 估计要踩很多坑.
    smartdone
        2
    smartdone  
    OP
       2020-05-13 11:21:48 +08:00
    @toooo 我也感觉,坑太多了。只是觉得用来写 UI 确实是方便了不少
    discrete
        3
    discrete  
       2020-05-13 11:35:08 +08:00
    smartdone
        4
    smartdone  
    OP
       2020-05-13 11:55:00 +08:00
    @discrete 感谢感谢
    lizhuoli
        5
    lizhuoli  
       2020-05-13 13:21:30 +08:00 via iPhone
    推荐用 NSHostingView,直接利用 AppKit API: NSView.tooltip 即可,一行代码
    minsheng
        6
    minsheng  
       2020-05-14 10:40:42 +08:00
    接楼上,你用 Catalyst 的 UIHoverGestureRecognizer 也很简单。
    smartdone
        7
    smartdone  
    OP
       2020-05-18 09:41:17 +08:00
    谢谢大佬们给我增长了这么多知识
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5487 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 06:52 · PVG 14:52 · LAX 23:52 · JFK 02:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.