【问题标题】:Hide or remove specific item from navigation bar button items, Swift 4从导航栏按钮项目中隐藏或删除特定项目,Swift 4
【发布时间】:2019-02-04 11:44:21
【问题描述】:

从故事板提供的导航栏中隐藏或删除特定按钮项UIBarButtonItem

例如,我在故事板中添加了 3 个UIBarButtonItem,例如“完成”、“取消”、“下一个”,现在我想以编程方式从导航栏中删除或隐藏“取消”按钮用户登录,那么我该如何解决这个问题?

【问题讨论】:

标签: ios swift uinavigationbar swift4 uibarbuttonitem


【解决方案1】:

试试这个:

self.navigationItem.rightBarButtonItems?.remove(at: [indexOfButton])

[indexOfButton] 应该是 rightBarButtonItems 数组中按钮的索引。

【讨论】:

    猜你喜欢
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多