Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS8交互式UILocaNotification-如何从警报选项中隐藏警报操作_Ios8_Uilocalnotification - Fatal编程技术网

iOS8交互式UILocaNotification-如何从警报选项中隐藏警报操作

iOS8交互式UILocaNotification-如何从警报选项中隐藏警报操作,ios8,uilocalnotification,Ios8,Uilocalnotification,我已经在我的一个应用程序中实现了基于iOS8的交互式UILocalNotification。我们需要更改默认文本,将“幻灯片解锁…”中的解锁更改为“响应”。为了实现这一点,我在创建通知时添加了一个名为“响应”的alertAction,效果非常好。 localNotification.alertAction=“respond” 然而,这给我带来了一个不必要的问题。我只需要选项1,选项2作为警报选项,但现在,“响应”作为顶部的另一个选项出现,这是我不需要的 是否有办法从警报操作中删除“响应”,但将其

我已经在我的一个应用程序中实现了基于iOS8的交互式UILocalNotification。我们需要更改默认文本,将“幻灯片解锁…”中的解锁更改为“响应”。为了实现这一点,我在创建通知时添加了一个名为“响应”的alertAction,效果非常好。
localNotification.alertAction=“respond”

然而,这给我带来了一个不必要的问题。我只需要选项1,选项2作为警报选项,但现在,“响应”作为顶部的另一个选项出现,这是我不需要的

是否有办法从警报操作中删除“响应”,但将其保留在锁定文本中,以替换“解锁”。这可能吗?我查看了API,没有发现任何有用的东西

NB:我想知道这是不是根本不可能说,

警戒行动 财产 动作按钮或滑块的标题

声明 敏捷的
var-alertAction:String?
讨论
指定一个字符串,或者最好是一个本地化的字符串键(使用NSLocalizedString)作为值。警报操作是警报右按钮的标题或解锁滑块的值,其中该值替换“滑动至解锁”中的“解锁”。如果指定nil,并且alertBody为非nil,“视图”(本地化为首选语言)将用作默认值。

以下两篇文章介绍了这些可能性:

ObjC:

斯威夫特:

以下是隐藏按钮直到在文本字段中输入所需字符数时的一些代码:

- (void)alertTextFieldDidChange:(UITextField *)sender
{
  UIAlertController *alertController = (UIAlertController *)self.presentedViewController;
  if (alertController)
  {
    UITextField *login = alertController.textFields.firstObject;
    UIAlertAction *okAction = alertController.actions.lastObject;
    okAction.enabled = login.text.length > 2;
  }
}

您提供了很多描述,但最好也发布代码..哇,还没有一个答案?您的问题是关于
UILocalNotification
,但您显示的图像是关于
UIAlertController
。你问的是哪一个?
- (void)alertTextFieldDidChange:(UITextField *)sender
{
  UIAlertController *alertController = (UIAlertController *)self.presentedViewController;
  if (alertController)
  {
    UITextField *login = alertController.textFields.firstObject;
    UIAlertAction *okAction = alertController.actions.lastObject;
    okAction.enabled = login.text.length > 2;
  }
}