这是我在一个按钮内编码的内容UITableViewCell.
var shareAlert = UIAlertController(title: "Post Alert",
message: "Your Post has been Shared with your Friends",
preferredStyle: UIAlertControllerStyle.Alert)
var Ok = UIAlertAction(title: "Ok",
style: UIAlertActionStyle.Default,
handler: nil)
shareAlert.addAction(Ok)
shareAlert.presentViewController(shareAlert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
当用户单击按钮时,我希望它显示此警报,但是一旦我单击按钮,应用程序就会崩溃.我做错了吗?如何从按钮中显示警报视图UITableViewCell?
我已经快速制作了游戏tic tac toe ..游戏完成后我停留在最后一点当用户再次按下播放按钮时我想将所有按钮图像设置回nil以便用户可以开始播放比赛又来了.我使用tag属性将其设置为nil.我编码了这个:
for i = 0 ; i < 8 ; i++ {
var button = view.viewWithTag[i] as! UIButton
button.setImage(nil, forState:.normal)
}
Run Code Online (Sandbox Code Playgroud)
但它给出了错误
无法将UIView类型的值转换为UIButton