我可以在操作表模式中为警报控制器添加长按事件。
如果长按用户希望在正常警报模式下再显示一次。
let actionSheet = UIAlertController.init(title: "Favourites", message: nil, preferredStyle: .actionSheet)
if(favLocations.count != 0){
for i in 0...(favLocations.count - 1){
actionSheet.addAction(UIAlertAction.init(title: favLocations[i].villageName, style: UIAlertActionStyle.default, handler: { (action) in
self.tbLocation.text = self.favLocations[i].villageName
}))
}
}
actionSheet.addAction(UIAlertAction.init(title: "Choose Locations", style: UIAlertActionStyle.destructive, handler: { (action) in
self.showAllLocationAvailable()
}))
actionSheet.addAction(UIAlertAction.init(title: "Cancel", style: UIAlertActionStyle.cancel, handler: { (action) in
}))
self.present(actionSheet, animated: true, completion: nil)
答案 0 :(得分:0)
我认为目前的iOS SDK无法实现。您可能希望实现自己的AlertController
或寻找一些开源库。