应用程序icon及UITabBar又上角带红圈中数字的实现

来源:互联网 发布:redhat7 yum源配置 编辑:程序博客网 时间:2024/05/21 17:59
引入在IOS应用中经常要在程序中显示应用更新状态,可能是通过程序本身,也可能是服务推送,那么怎样在应用icon及UITabBar又上角带红圈中数字呢,下面将简单说明。实现//ICON[[UIApplication sharedApplication] setApplicationIconBadgeNumber:number];//number为显示在ICON上的整数 //UITabBar[tabBarItem setBadgeValue:[NSString stringWithFormat:@"%d",number]];//tabBarItem获取方法:[[[tabBarCtr tabBar] items] objectAtIndex:i];【tabBarCtr为APPDelegate中的UITabBarController,i表示第i个TabBar】// number为显示在TabBar上的整数

[UIApplication sharedApplication].applicationIconBadgeNumber


//清除icon

    [[UIApplicationsharedApplication] setApplicationIconBadgeNumber:0];

    

   //清楚通知栏

    NSArray* scheduledNotifications = [NSArrayarrayWithArray:[UIApplicationsharedApplication].scheduledLocalNotifications];

    application.scheduledLocalNotifications = scheduledNotifications;



原创粉丝点击