我在操作表中有一个类似的按钮:
likeAction = UIAlertAction(title: "Like this post", style: UIAlertActionStyle.Default, handler: { (action) -> Void in
println("like pressed")
})
一旦按下,我想将标题更新为"与此帖子不同#34;
标题是只读的,UIAlertActions上没有SetTitle()函数。
非常感谢。
答案 0 :(得分:0)
Lyndsey Scott in a comment在原帖上回答了这个问题。
设置一个bool变量以指示帖子是否为“已赞”,然后有条件地设置警告标题。
答案 1 :(得分:0)
这对我有用。
self.alertAction.setValue("New Title", forKeyPath: "title")
希望这有帮助。