首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIKeyCommand discoverabilityTitle不赞成

UIKeyCommand discoverabilityTitle不赞成
EN

Stack Overflow用户
提问于 2019-07-12 13:59:23
回答 1查看 1.1K关注 0票数 4

根据文档,现在不推荐使用discoverabilityTitle的方便初始化器:

代码语言:javascript
复制
    // Key Commands with a discoverabilityTitle _will_ be discoverable in the UI.
    @available(iOS, introduced: 9.0, deprecated: 13.0)
    public convenience init(input: String, modifierFlags: UIKeyModifierFlags, action: Selector, discoverabilityTitle: String)

现在创建用户可发现键命令的替代方法是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-12 14:04:53

在iOS 13中引入了新的扩展初始化器:

代码语言:javascript
复制
@available(iOS 13.0, *)
extension UIKeyCommand {

    /// Initializes a key command with extra properties.
    ///
    /// - Parameters:
    ///   - title: Short display title. This should be localized.
    ///   - action: Action to execute on choosing this command.
    ///   - input: Keys that must be pressed to choose this command.
    ///   - modifierFlags: Bit mask of key modifier flags to choose this command.
    ///   - propertyList: Property list object to distinguish commands, if needed.
    ///   - alternates: Alternates that differ in modifier flags, if needed.
    ///   - image: Image that can appear next to the command, if any.
    ///   - discoverabilityTitle: Elaborated title, if any.
    ///   - isEnabled: Whether to enable or disable the command.
    ///   - state: State that can appear next to the command.
    public convenience init(title: String, action: Selector, input: String, modifierFlags: UIKeyModifierFlags = [], propertyList: Any? = nil, alternates: [UICommandAlternate] = [], image: UIImage? = nil, discoverabilityTitle: String? = nil, isEnabled: Bool = true, state: UIMenuElement.State = .off)
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57008527

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档