• 请不要在回答技术问题时复制粘贴 AI 生成的内容
flashlight
V2EX  ›  程序员

有没有大神知道 Mac 字典这种原生点击单词去下一个单词是怎么实现的?

  •  
  •   flashlight · Jan 5, 2023 · 1311 views
    This topic created in 1263 days ago, the information mentioned may be changed or developed.

    就是点击任意一个单词就可以去下一个单词 然后持续点下去 这种交互在原生 macOS 和 iOS 里面是怎么实现的呢?怎么能选择一个字呢?甚至这个选择中文的时候可以选择词组。

    想做一个类似的字典 App 练手但是不知道要跨平台做这个的最佳实践是怎么样的。

    Imgur

    iOCZ
        1
    iOCZ  
       Jan 5, 2023
    core text 中类似 CTFrameGetLineOrigins() CTLineGetStringIndexForPosition()之类的 API
    或者 textkit
    flashlight
        2
    flashlight  
    OP
       Jan 5, 2023
    @iOCZ 感谢本人是 苹果开发小白 简单的搜了一下这种 API 是不是 SwiftUI 还没有支持 找不到什么相关的资料
    iOCZ
        3
    iOCZ  
       Jan 6, 2023   ❤️ 1
    @flashlight swiftui 只是 UI ,UI 不是全部
    flashlight
        4
    flashlight  
    OP
       Jan 6, 2023 via iPhone
    @iOCZ 谢谢你的解答
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3181 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 12:31 · PVG 20:31 · LAX 05:31 · JFK 08:31
    ♥ Do have faith in what you're doing.