开发者

Is it possible to make an alarm using NSTimer and UIDatepicker?

I have an app which plays some ambient noises. I have fitted it with a sleep timer and a local notifier which work fine, but the notifier will only fire when the ap开发者_如何学运维p is in the background.

I would like to be able to fit a standard alarm clock that the user can set using the date picker, ie, the user picks 07:15 am on the date picker and this triggers a sound being played at this time. Can this be done?


I would stick with local notifications, you can listen for them while the app is active using

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification

And to play your sound you can set the soundName property of your notification.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜