【发布时间】:2015-09-04 05:31:29
【问题描述】:
我正在使用一个 UICollectionView,标题中有一个 Map。
我想处理核心位置错误。我有 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)
}
如何将此UIAlertView 发送到UICollectionView 的屏幕?
【问题讨论】:
-
在那里获取父
UICollectionView和presentViewController。 -
@ILikeTau
UICollectionView是UIView的子类,而不是UIViewController的子类。它不知道如何presentViewController。 -
在您使用 collectionview 的 viewcontroller 中执行此操作。
-
@TheParamagneticCroissant 哎呀。我的意思是视图控制器。
-
如何在视图控制器中实现?
标签: ios uialertview uicollectionviewcell