带徽章编号的UISegmentedControl [英] UISegmentedControl with badge number

查看:186
本文介绍了带徽章编号的UISegmentedControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像标签栏一样,我想在 UISegmentedControl 上显示徽章。因为我无法看到 UISegmentedControl 的任何预定义方法,就像 UITabBar 一样。

Just like the tabbar, I want to show badge on UISegmentedControl. As I cant see any predefined methods for UISegmentedControl just like available for UITabBar.

I考虑将徽章作为图像添加到它上面,但也许有更好的方法。

I thought about adding the badge as an image just on top of it, but maybe there is some better way.

推荐答案

这里是一个小型的第三方库,我用它来绘制各种各样的徽章。这很不错。例如,更改徽章的颜色以匹配我的设计是微不足道的。

Here is a little third party library I've used to draw badges on various things. It's pretty nice. For example, changing the color of the badge to match my design was trivial.

将此类带入项目并将其包含到视图控制器中后,您将:

Once you bring this class into your project and include it into your view controller, you go:

CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@"Badge 1"];

...然后添加customBadge1作为你要标记的任何东西的子视图。

...and then add customBadge1 as a subview of whatever thing you're badging.

这篇关于带徽章编号的UISegmentedControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆