【发布时间】:2018-02-02 05:56:41
【问题描述】:
如何在不使用 didSelectItemAtIndexPath 和 prepareForSegue 的情况下找到选定集合视图单元格的索引路径?
我在 AlertViewController 中使用这个 indexPath。我不知道如何在 AlertView 控制器中获取这个 indexPath。
//Edit Selected Category
let alertController = UIAlertController(title: "Alert", message: "Rename your ", preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .default)
alertController.addTextField(configurationHandler: {(textField: UITextField) -> Void in
if let iP: IndexPath = self.collCategory.indexPath(for: CategoryCollectionCell) {
print("IP \(iP)")
}
})
alertController.addAction(actionOK)
self.present(alertController, animated: true, completion: nil)
【问题讨论】:
-
collectionView.indexPathsForSelectedItems -
如何在没有用户交互的情况下呈现这个
UIAlertController?如果您有一些代码,请提供。
标签: ios swift uialertcontroller nsindexpath