gpt4 book ai didi

iOS 警告 : Attempt to dismiss from view controller while a presentation or dismiss is in progress

转载 作者:行者123 更新时间:2023-11-29 02:46:21 27 4
gpt4 key购买 nike

我创建了一个 UIImageView。当点击它时,一个 UIActionSheet 会弹出。

@IBOutlet weak var avatarImageView: UIImageView!

@IBAction func tapUIImageViewHandler(sender: UITapGestureRecognizer) {
var popMenu: UIActionSheet = UIActionSheet(title: "Upload user avatar", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles: "Choose from library", "Take photo")
popMenu.showInView(self.view)
}

func actionSheet(popMenu: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int){
println("click at index \(buttonIndex)")
switch buttonIndex {
case 2:
takePhoto()
case 1:
chooseFromLib()
default:
break
}
}

但是当我在模拟器上运行它时,在我点击 UIActionSheet 上的按钮后,我得到了

Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!

有人可以帮我吗?谢谢!

最佳答案

请在呈现操作表时实现小延迟。

[self performSelector:@selector(presentActionsheet) withObject:nil afterDelay:0.2f];

关于iOS 警告 : Attempt to dismiss from view controller while a presentation or dismiss is in progress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25073650/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com