UISegmentedControl with Badge or Highlighting

二次信任 提交于 2020-01-17 01:40:49

问题


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.


回答1:


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

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).



来源:https://stackoverflow.com/questions/3669673/uisegmentedcontrol-with-badge-or-highlighting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!