Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的 UIToolbar 中为 UIBarButtonItem 设置一个徽章编号。这可能吗?它的功能与普通应用程序图标的徽章编号相同。有什么建议吗?我有一个方法可以返回一个设置为徽章计数的数字。
工具栏项目通常不显示徽章编号,这些通常是 TabBars。除此之外,如果您为工具栏中的项目使用自定义视图,您可以创建一个视图并将其添加到项目顶部。
要使徽章拉伸,您可以使用resizableImage WithCapInsets:或stretchableImageWithLeftCapWidth:topCapHeight : 将其设置为背景图像,具体取决于您的 iOS 目标。该数字只是一个白色文本 UILabel。
您可以使用此图像: