简体   繁体   English

右侧导航按钮顶部的徽章

[英]Badge on top of right navigation button

I have a requirement where I need to show the badge number on top of the right navigation button.我有一个要求,我需要在右侧导航按钮的顶部显示徽章编号。 Something like this:像这样的东西:

在此处输入图片说明

How to show the badge on top of UIBarButtonItem in the navigation bar?如何在导航栏中的UIBarButtonItem顶部显示徽章?

I am still using Xcode 7.3.1, Swift 2.2.我仍在使用 Xcode 7.3.1、Swift 2.2。

I am working with this Framework here:我在这里使用这个框架:

https://github.com/enmiller/ENMBadgedBarButtonItem-Swift https://github.com/enmiller/ENMBadgedBarButtonItem-Swift

Otherwise you could create your own View with a Badge.否则,您可以使用徽章创建自己的视图。 Just make an Custom UINavigationItem.只需制作一个自定义 UINavigationItem。

For example:例如:

let rightBarButton = UIBarButtonItem(customView: AnyOfYourCustomViews)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM