Add message notifications Little Red dot iOS comes with
Nsarray *tabbaritems = Self.navigationController.tabBarController.tabBar.items;
Uitabbaritem *personcentertabbaritem = [Tabbaritems objectatindex:2];
Personcentertabbaritem.badgevalue = @ "1";
Custom method (also perfect)
Uiimageview *dotimage = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:@ "Ic_speed_check"];
Dotimage.backgroundcolor = [Uicolor Clearcolor];
CGRect Tabframe =self.navigationcontroller.tabbarcontroller.tabbar.frame;
CGFloat x =CEILF (0.9 * tabFrame.size.width);
CGFloat y =ceilf (0.1 * tabFrame.size.height);
Dotimage.frame =cgrectmake (x, y, 8,8);
[Self.navigationController.tabBarController.tabBar Addsubview:dotimage];
Add a hint to an app icon
Uiusernotificationsettings *settings = [uiusernotificationsettings
Settingsfortypes:uiusernotificationtypebadge Categories:nil];
[[UIApplication sharedapplication] registerusernotificationsettings:settings];
[UIApplication sharedapplication].applicationiconbadgenumber = 2;
In the Svsettingsviewctrl class:
1. In-(UITableViewCell *) TableView: (UITableView *) Tableviewcellforrowatindexpath: (Nsindexpath *) Indexpath method add
Add when first appears
Svprobeinfo *probeinfo = [Svprobeinfo sharedinstance];
if (![ Probeinfo Isfirststart])
{
if (Indexpath.row = = 0)
{
Show new feature guidelines
[Self Shownewview:cell];
Set the first boot flag bit
[Probeinfo Setfirststart:yes];
}
}
2. Add a method:
Add new Feature Tips
-(void) Shownewview:(UITableViewCell *) cell{
BTN = [[UIButton alloc]init];
Button type
BTN = [UIButton buttonwithtype:uibuttontypecustom];
Button size
Btn.frame = CGRectMake (fitwidth), Cell.height *0.25, cell.height,cell.height*0.5);
Button background color
Btn.backgroundcolor = [Uicolor Redcolor];
Set text
[Btn settitle:@ "new" forstate:uicontrolstatenormal];
Button rounded Corners
Btn.layer.cornerRadius = Svcornerradius (30
);
Set Center
Btn.titleLabel.textAlignment = Nstextalignmentcenter;
button text color and type
[btn Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatenormal];
Set Font size
[Btn.titlelabel Setfont:[uifont Systemfontofsize:pixeltofontsize (40)];
The Settings button is not interactive by default
btn.enabled = NO;
[Cell ADDSUBVIEW:BTN];
}
Hide new Feature Tips
-(void) hidenewview{
[Btn Removefromsuperview];
}
3. In-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath add
Add when first appears
Svprobeinfo *probeinfo = [Svprobeinfo sharedinstance];
if (![ Probeinfo Isfirststart])
{
if (Indexpath.row = = 0)
{
[Self hidenewview];
}
}
IOS message notification Little red dot & custom Little red dot & app icon add hint