2012-12-09 33 views
0

我知道如何在AppDelegate中的applicationDidEnterBackground函數中創建本地通知。用戶自定義ui本地通知設置

- (void)applicationDidEnterBackground:(UIApplication *)application 

{

UILocalNotification * uln = [[UILocalNotification alloc] init]; 
uln.fireDate = [NSDate dateWithTimeIntervalSinceNow:10]; 
uln.timeZone = [NSTimeZone defaultTimeZone]; 

uln.alertBody = @"Did you forget something?"; 
uln.alertAction = @"Show me"; 
uln.soundName = UILocalNotificationDefaultSoundName; 
//uln.applicationIconBadgeNumber = 0; 
uln.repeatInterval = NSMinuteCalendarUnit; 
application.scheduledLocalNotifications = [NSArray arrayWithObject:uln]; 

}

但是,這是可能的,用戶可以設置一個時間fireDate和請勿打擾的時間像在午夜晚?

回答

1

是的,你可以設置未來的任何日期的財產。請勿打擾用戶在iOS6的「設置」中觸發自己。

+0

謝謝!但我可以問一個簡單的問題嗎?我認爲用戶應該在viewController中設置時間。我如何在AppDelegate文件中使用此值?我是一個初學者... – lancellx

+0

如果你是編程可可的新手,我建議你從本教程開始http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphone101/Articles/00_Introduction.html由Apple。 –

+0

謝謝我已經做到了 – lancellx