代码之家  ›  专栏  ›  技术社区  ›  Tariq

带徽章编号的UISegmentedControl

  •  5
  • Tariq  · 技术社区  · 16 年前

    就像tabbar一样,我想展示徽章 UISegmentedControl UISegmentedControl公司 就像在 UITabBar .

    alt text

    3 回复  |  直到 11 年前
        1
  •  11
  •   bunnyhero    10 年前

    Here 是一个小的第三方图书馆,我曾经在各种各样的东西上画徽章。很不错。例如,改变徽章的颜色以匹配我的设计是微不足道的。

    将该类引入项目并将其包含到视图控制器中后,可以执行以下操作:

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

    …然后添加customBadge1作为您要标记的任何内容的子视图。

        2
  •  6
  •   Dave T    14 年前

    我今天遇到了这个问题,所以我已经组合了一个UISegmentedControl子类,它允许您轻松地在每个段上设置徽章号。

    [segmentedControl setBadgeNumber:1 forSegmentAtIndex:0];
    

    截图、文档和源代码位于 https://github.com/dave-thompson/MESegmentedControl .

        3
  •  0
  •   Thomas Clayson    16 年前

    没有徽章属性或方法-与选项卡栏不同。如果你想这样做,你只需要在它上面放一个自定义图像。您可以对分段控件进行子类化,并创建一个函数来为您执行此操作。