这段代码出错了,添加alertVC.setValue(alertView, forKey: "FullintentViewController")的时候就会出现terminating with uncaught exception of type NSException的错误,是怎么回事呢
直接addSubview
var alertController = UIAlertController(title: "\n\n\n\n\n\n", message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)
let margin:CGFloat = 8.0
let rect = CGRectMake(margin, margin, alertController.view.bounds.size.width - margin * 4.0, 100.0)
var customView = UIView(frame: rect)
customView.backgroundColor = UIColor.greenColor()
alertController.view.addSubview(customView)
let somethingAction = UIAlertAction(title: "Something", style: UIAlertActionStyle.Default, handler: {(alert: UIAlertAction!) in println("something")})
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: {(alert: UIAlertAction!) in println("cancel")})
alertController.addAction(somethingAction)
alertController.addAction(cancelAction)
self.presentViewController(alertController, animated: true, completion:{})