带有徽章或突出显示的UISegmentedControl [英] UISegmentedControl with Badge or Highlighting

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

问题描述

有时,我想突出显示 UISegmentedControl 的一部分,即第三个标题是新闻",并希望引起用户的注意.理想情况下,使用带有 UITabBar 上的数字的红色徽章-您知道如何实现此目标吗?也可以随意分享其他想法.我曾考虑过将徽章作为图像添加到其顶部,但是也许有更好的方法.

Occasionally I want to highlight one of segments of a UISegmentedControl, i.e. the third title is "News" and I want to draw user's attention to it. Ideally with a red badge with a number as on the UITabBar - any idea how to achieve this? Feel free to share other ideas as well. I thought about adding the badge as an image just on top of it, but maybe there is some better way.

推荐答案

我不会认为有更好的诚实方式.

I wouldn't have thought there is a better way to be honest.

最简单的方法是(可能)继承uisegmentedcontrol并为其添加徽章标签.或类似的东西.(子类uiview向其中添加uisegmentedcontrol并向其添加徽章标签.)

The easiest way will be (probably) to subclass uisegmentedcontrol and add a badge label to it. Or something similar. (subclass uiview add a uisegmentedcontrol to it and add a badge label to it).

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

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