ios 各种提示小红圈属性设置

来源:互联网 发布:淘宝试用中心入口 编辑:程序博客网 时间:2024/05/17 06:13

1  UITabBarItem 的小红圈属性是 badgeValue

   tabBarItem.badgeValue =@"";//显示红圈

   tabBarItem.badgeValue =nil; // 隐藏

   tabBarItem.badgeValue =@"1";// 显示个数


2   [UIApplicationsharedApplication].applicationIconBadgeNumber  应用提示 // 默认是0  不显示 


3 自定义一个lable添加View上显示

    UILabel *lbl_card_count = [[UILabelalloc]initWithFrame:CGRectMake(0,0,16, 16)];

    lbl_card_count.font = [UIFontboldSystemFontOfSize:12];

    lbl_card_count.textColor = [UIColorwhiteColor];

    lbl_card_count.textAlignment = NSTextAlignmentCenter;

    lbl_card_count.text = @"1";

    lbl_card_count.layer.borderWidth =1;

    lbl_card_count.layer.cornerRadius =8;

    lbl_card_count.layer.masksToBounds =YES;

    lbl_card_count.layer.borderColor =[[UIColorclearColor] CGColor];

    lbl_card_count.layer.shadowColor = [[UIColorclearColor] CGColor];

    lbl_card_count.layer.shadowOffset =CGSizeMake(0.0, 0.0);

    lbl_card_count.layer.shadowOpacity =0.0;

    lbl_card_count.backgroundColor = [UIColorredColor];

0 0
原创粉丝点击