0
我有PhotoBrowser
(它從UIViewController
繼承)作爲presentedViewController
。我從UITableViewController
提出。當我點擊按鈕時,PhotoBrowser
呈現actionMainController
(它繼承自UIAlertController
)。我想調用另一個UIAlertController
,當我在actionMainController中選擇其中一個動作並在其被解除後立即顯示第二個UIAlertController
但完成塊不起作用。我想補充一點,駁回actionMainController
成功,它的工作原理耗盡完成塊不起作用。 Swift
class PhotoBrowser: SKPhotoBrowser {
// MARK: - Controllers
private var actionMainController = UIAlertController()
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - override var
override var prefersStatusBarHidden: Bool {
return true
}
// MARK: - functions
func editAvatar() {
debugPrint("removePhoto")
actionMainController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
actionMainController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
let deleteAction = UIAlertAction(title: "Delete Photo", style: .destructive) { (action) in
self.deletePhoto()
}
let takePhoto = UIAlertAction(title: "Take Photo", style: .default) { (action) in
}
let choosePhoto = UIAlertAction(title: "Choose Photo", style: .default) { (action) in
}
actionMainController.addAction(deleteAction)
actionMainController.addAction(takePhoto)
actionMainController.addAction(choosePhoto)
present(actionMainController, animated: true, completion: nil)
}
private func deletePhoto() {
actionMainController.dismiss(animated: true) {
// TODO: it
// self.showDeleteActionSheet()
}
showDeleteActionSheet()
}
private func showDeleteActionSheet() {
let deleteActionController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
deleteActionController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
let deleteAction = UIAlertAction(title: "Delete Photo", style: .destructive) { (action) in
}
deleteActionController.addAction(deleteAction)
present(deleteActionController, animated: true, completion: nil)
}
}
行動的完成處理一些工作,把一個斷點在那裏,它被調用? – Tj3n
從哪個類調用deletePhoto方法? –
@Tj3n斷點沒有調用 – Alexander