1. The IOS 8 Corner display requires user authorization to request authorization when the app starts:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {if([[Uidevice currentdevice].systemversion Doublevalue] >=8.0) {Uiusernotificationtype types= Uiusernotificationtypebadge | Uiusernotificationtypesound |Uiusernotificationtypealert; Uiusernotificationsettings*notificationsettings =[uiusernotificationsettings settingsfortypes:types Categories:nil]; [[UIApplication sharedapplication] registerusernotificationsettings:notificationsettings]; } Else{uiremotenotificationtype Types= Uiusernotificationtypebadge | Uiusernotificationtypesound |Uiusernotificationtypealert; [[UIApplication sharedapplication] registerforremotenotificationtypes:types]; } returnYES; }
2. Display the angle label:
- (void) showbadgenumbers{
Request Method (the server returns the specified data datas)
// If no new data if([Datas isequaltostring:@"0"]) {[Self cleanbadgenumber]; } Else { //Tabbaritem The upper right corner shows no readingsSelf.tabBarItem.badgeValue =datas; //app not read in top right corner[UIApplication Sharedapplication].applicationiconbadgenumber =Datas.intvalue; }}
3. Clear the corner mark:
-(void) cleanbadgenumber{ // Tabbaritem The top right corner shows the number of unread tweets Self.tabBarItem.badgeValue = nil; // app Unread Weibo is displayed in top right corner of application 0 ;}
4. Set Timer Automatic call
-(void
{ [Super Viewdidload];
// show no readings Nstimer *timer = [Nstimer scheduledtimerwithtimeinterval: target:self selector: @selector ( showbadgenumbers) Userinfo:nil Repeats:yes]; // Join Runloop [[Nsrunloop Mainrunloop] Addtimer:timer formode:nsrunloopcommonmodes]; }
5. The app goes into the background to continue calling
-(void) Applicationdidenterbackground: (UIApplication *
{ // apply for background run qualification to operating system, background run time is controlled by system __block uibackgroundtaskidentifier taskidentifier = [ Application beginbackgroundtaskwithexpirationhandler:^{ // Background run time has ended / / End Task [application endbackgroundtask:taskidentifier]; }];}
IOS 8 display App Corner label