ios - custom view when local notification is fired -
i relatively new xcode, building simple alarm clock , below small snippet of app. question is: how display custom view ( i.e. picture or animation ) when alarm fired, , put " dismiss " button on ? thank in advance
nicola
- (void) schedulelocalnotificationwithdate:(nsdate *)firedate :(nsstring *)message { uilocalnotification *notificaiton = [[uilocalnotification alloc] init]; if (notificaiton == nil) return; notificaiton.firedate = firedate; notificaiton.alertbody = message; notificaiton.timezone = [nstimezone defaulttimezone]; notificaiton.alertaction = @"view"; notificaiton.soundname = @"alarm-clock-1.mp3"; notificaiton.applicationiconbadgenumber = 1; notificaiton.repeatinterval = kcfcalendarunitweekday; nslog(@"repeat interval %@",notificaiton.description); [[uiapplication sharedapplication] schedulelocalnotification:notificaiton];
use method
handle notificaton when app running
- (void)application:(uiapplication *)app didreceivelocalnotification:(uilocalnotification *)notif { // show custom alert view }
handle launching notification
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { uilocalnotification *localnotif = [launchoptions objectforkey:uiapplicationlaunchoptionslocalnotificationkey]; if (localnotif) { // show custom alert view } return yes; }
Comments
Post a Comment