Gáb*_*tos 3 uialertview ios uicollectionviewcell
我在标题中使用带有Map的UICollectionView.
我想处理核心位置错误.我有3种错误类型,其中两种我想呈现一种UIAlertView.
但我收到一个错误,因为UICollectionViewCell没有一个成员叫presentViewController.
func locationUnknown() {
var alert = UIAlertController(title: "Location Unknown", message: "Please try again later.", preferredStyle: UIAlertControllerStyle.Alert)
let alertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (action: UIAlertAction!) -> Void in
})
alert.addAction(alertAction)
self.presentViewController(alert, animated:true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
如何将其发送UIAlertView到UICollectionView屏幕?
peg*_*gli 12
使用窗口的根视图控制器来显示警报:
self.window?.rootViewController?.present(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)