加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 如何在UIBarButtonItem上使用info按钮

发布时间:2020-12-14 05:23:21 所属栏目:百科 来源:网络整理
导读:如何在UIBarButtonItem上使用信息灯? 我不想使用自定义图像,因为结果不是很好.我想使用Apple“信息”按钮. 我正在使用Swift. 谢谢. 没有直接的方法来使用 UIBarButtonItem APIs创建这样的条形按钮. 您可以使用配置了.InfoLight UIButton的自定义视图,如建议
如何在UIBarButtonItem上使用信息灯?

我不想使用自定义图像,因为结果不是很好.我想使用Apple“信息”按钮.
我正在使用Swift.

谢谢.

没有直接的方法来使用 UIBarButtonItem APIs创建这样的条形按钮.

您可以使用配置了.InfoLight UIButton的自定义视图,如建议的here:

// Create the info button
let infoButton = UIButton(type: .infoLight)

// You will need to configure the target action for the button itself,not the bar button itemr
infoButton.addTarget(self,action: #selector(getInfoAction),for: .touchUpInside)

// Create a bar button item using the info button as its custom view
let infoBarButtonItem = UIBarButtonItem(customView: infoButton)

// Use it as required
navigationItem.rightBarButtonItem = infoBarButtonItem

如果您需要更多帮助,请随时发表评论.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读