显示UIAlertView中某些日期?

问题描述 投票:0回答:1

我不知道我怎么会做一个UIAlertView中显示在特定的日期,例如,用户下载的iPhone应用程序,然后在8月12日,预定UIAlertView中显示?我怎么能这样做?

谢谢!

iphone objective-c uialertview
1个回答
1
投票

你应该看看UILocalNotification API。它允许你创建和调度本地通知您的应用程序,这将在随后的所需日期使用徽章/酥料饼/声音(相同的设置作为远程通知API)被解雇。

对于你的情况应具体采取看看fire date。示例代码看起来更多收起这样的:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = @"Your message here";
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:60*60];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

这将触发在一小时“您的留言”文本本地通知。

© www.soinside.com 2019 - 2024. All rights reserved.