我正在开发iOS
应用程序,我需要开发以下警报标准功能。
我做过研究,没有发现任何帮助,首先我想知道它真的有可能吗? iOS上的这些功能有任何限制吗?如果有可能请引导我,以便我可以探索。
提前完成。
答案 0 :(得分:0)
有可能做到。您必须为其发布LocalNotification。看看这个post。
要创建振动,您可以使用AudioToolBox.framework。
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
答案 1 :(得分:0)
// Yes it is possible ,for alarm you have to use UILocalNotification class
For example :
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
//---set the notification to go off in 10 seconds time---
localNotification.fireDate =[[NSDate alloc] initWithTimeIntervalSinceNow:10];
//---the message to display for the alert---
localNotification.alertBody = message.text; localNotification.applicationIconBadgeNumber = 1;
//---uses the default sound---
localNotification.soundName = UILocalNotificationDefaultSoundName; //---title for the button to display---
localNotification.alertAction = @”View Details”;
//---schedule the notification---
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
//---display the notification now---
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
- (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”Inside
application:didReceiveLocalNotification:”
message:notification.alertBody
delegate:self cancelButtonTitle:@”OK” otherButtonTitles:nil];
[alert show];
[alert release]; }
//application:didReceiveLocalNotification: method is also called when the
application is running and the local notification is fired.