问题标签 [uialertaction]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
1570 浏览

ios - 在 Swift 中继承 UIAlertAction 的问题

这是我的代码:

但是我得到了以下编译错误:

必须调用超类“UIAlertAction”的指定初始化程序

我知道 UIAlertAction 的指定初始化程序是 init()。但是 UIAlert 的 init(title, style, handler) 不会调用它指定的初始化器 init() 吗?

任何想法?谢谢

PS:基于苹果的文档:

指定初始化器必须从其直接超类中调用指定初始化器。”

这是否意味着不允许在 Swift 中继承 UIAlertAction?在 Objective-C 中这样做是没有问题的。

我之所以要创建 UIAlertAction 的子类,是因为我想添加一个 ReactiveCocoa 命令作为操作。

0 投票
0 回答
800 浏览

fonts - 在 Swift 中更改 UIAlertAction 的字体

更改 UIAlertViewController 对象的消息和标题的字体已在此处得到解答:如何在 UIAlertController 中更改 UIAlertAction 的字体大小和颜色

但我想知道如何使用 Swift 更改 UIAlertAction (iOS8+) 标题上的字体。不幸的是,UIAlertAction 实例没有一个名为“attributedTitle”的属性,就像 UIAlertController 一样。

我想扩展以更改字体的代码如下:

任何想法将不胜感激。

0 投票
2 回答
1385 浏览

swift - Swift 2.0 不允许我制作 UIAlertAction

这张照片应该说够了: 在此处输入图像描述

我一直在网上寻找答案,但似乎没有其他人有这个问题。我正在使用 Xcode 7 Beta 3 和 Swift 2。我不知道出了什么问题。

提前致谢

编辑:

这是代码:

0 投票
1 回答
1143 浏览

swift - 无法向 UIAlertController (Swift) 添加警报操作

我正在尝试将 Ok 按钮添加到 UI 警报,但我无法使用 alertController.addAction 添加它

在这种情况下我该怎么办?

提前致谢!!

0 投票
1 回答
120 浏览

swift - 重复电子邮件警报 Swift + Parse

我正在尝试拥有它,因此当用户创建帐户时...如果在出现“已创建帐户”的警报框之前尚未使用他们的电子邮件,并且如果已创建电子邮件(在 Parse 上),则发出警报应该出现通知用户。

我似乎无法让我的代码同时执行这两项操作..只显示一条消息。我在这里做错了什么?

谢谢!

0 投票
2 回答
2857 浏览

swift - UIAlertAction 可以触发函数吗?

是否可以将函数连接到UIAlertAction?

那么在用户单击“确定”按钮后,它会执行一个操作吗?这不是 handler 参数的作用吗?

...

0 投票
3 回答
1441 浏览

ios - 向 UIAlert 添加操作,将用户带到设置

我有一个 UIAlert 通知用户他们没有互联网连接并且他们需要一个才能使用该应用程序。除了让他们通过点击 ok 操作来解除警报之外,我还希望有一个操作,当点击时将用户带到设置应用程序。

0 投票
4 回答
2898 浏览

ios - UIAlertAction handler is not called

I have a UITableView and in the delegate (view controller), I have implemented the function

I then test for the editing style

As part of the delete, I am requesting confirmation from the user, if they select "yes", the item related to the row will be deleted, if they select no, I reset the editing style.

The problem I appear to have is that neither completion handler is being called. I've used this format elsewhere with no issues.

The alert appears with the title, message and the buttons "Cancel" and "Yes". If I tap on either, nothing happens. The alert is dismissed and there are is no console output for the println statements and there is definitely nothing else happening. My delete code isn't executed for "Yes" and the editing reset isn't called for "cancel".

I have this same setup on other tableviews within the application and they work as expected.

This is in a view controller that has been presented modally from another view controller (if that has any bearing). I'm not getting any errors about any other presenting going on (hence the if self.presentedViewController == nil block).

I've obviously gone wrong somewhere, but at the moment I just can't see where. Any ideas?

IOS version being used in 8.4. Target is iPad.

0 投票
1 回答
684 浏览

swift - 警报按钮操作无法快速工作

我有一个带有多个按钮的 alerviewcontroller。这些按钮是基于数组值创建的。我的代码如下所示,按钮操作无法正常工作。

0 投票
4 回答
2627 浏览

ios - Swift:UITableView 无法使用 reload() 正确更新数据

我有一个 30ish 的 lang 表,分为 4 个部分..

我的问题是,当我想更改其中一个单元格中的值时,该值不会更新/更改,直到我将该单元格滚动出视图并返回..

我使用 UIAlert 输入新值,然后将其保存到数据库中。并且该值已保存好,然后我再次从数据库中取回正确的值。

但是当我重新加载tableView它并没有显示新值..

Bouns:我有两个 tableView 一个名为:templateTableView和一个名为:fieldTableViewfieldTableView是我正在尝试更改值的那个。更改tableView.reload()self!.fieldTableView.reload()也不起作用。

从 didSelectRowAtIndexPath:

编辑 应该工作的代码部分是这样的: