如何在通知显示为警报时自定义显示的按钮?让我澄清一下我的意思:在我创建了一些交互式通知操作并将它们放在一个类别中以供我的本地通知使用之后,一切都很有效 . 但是,当通知显示为警报视图时,我只获得两个按钮: Close 和 Options . 有没有办法自定义这些按钮?与提醒应用程序的工作方式类似,您可以使用这两个按钮而不是 Close 和 Options .
And this is what I get:
有人可以澄清一下发生了什么吗?
您可以通过更改其值来自定义按钮 Headers ,这是一个示例:
UIAlertView* alert; alert = [[UIAlertView alloc] initWithTitle:@"Reminder" message:@"Reminder" delegate:nil cancelButtonTitle:@"Mark as Completed" otherButtonTitles: @'Later']; [alert show]; [alert release];
以下是推送通知的示例:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler { if (application.applicationState == UIApplicationStateActive) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" message:userInfo[@"Reminder"][@"alert"] delegate:nil cancelButtonTitle:@"Mark as Completed" otherButtonTitles:@"Later"]; [alertView show]; } else if (application.applicationState == UIApplicationStateBackground || application.applicationState == UIApplicationStateInactive) { } }
不,没有办法改变这个 Headers ,它只会是关闭和选择 .
提醒应用程序有不同的场景,它仅附带iOS版本 . 所以它基本上是这样编码的 .
但在应用开发中,我们可以改变它 .
2 回答
您可以通过更改其值来自定义按钮 Headers ,这是一个示例:
UIAlertView* alert; alert = [[UIAlertView alloc] initWithTitle:@"Reminder" message:@"Reminder" delegate:nil cancelButtonTitle:@"Mark as Completed" otherButtonTitles: @'Later']; [alert show]; [alert release];
以下是推送通知的示例:
不,没有办法改变这个 Headers ,它只会是关闭和选择 .
提醒应用程序有不同的场景,它仅附带iOS版本 . 所以它基本上是这样编码的 .
但在应用开发中,我们可以改变它 .