I am using PopoverView to show options in tableview cell button like this screen shot
here if i use like this no error.. but if check conditions with if statements then crash and error
@objc func showOptions(sender:UIButton) {
popoverView?.show(with: ["View", "View Proposal", "Delete"], sender: sender, showDirection: .up)
}
but here for each cell i need to show different options according to below conditions
code for cell button action: here open, close, in progress.. all are segmented modes
@objc func showOptions(sender:UIButton) {
if mode == .Open{
popoverView?.show(with: ["View", "View Proposal", "Delete"], sender: sender, showDirection: .up)
}
if (mode == .Open) && (bidsCount > 0){
popoverView?.show(with: ["View", "View Proposal", "Edit", "Delete"], sender: sender, showDirection: .up)
}
if mode == .In_progress{
popoverView?.show(with: ["View", "View Proposal", "Delete"], sender: sender, showDirection: .up)
}
if mode == .Awarded{
popoverView?.show(with: ["View", "Delete"], sender: sender, showDirection: .up)
}
if mode == .Closed{
popoverView?.show(with: ["View"], sender: sender, showDirection: .up)
}
}
PopoverView code:
extension PageContentViewController: PopoverViewDelegate {
func value(didSelect item: String, at index: Int, indexPath: IndexPath, sender: UIView) {
if item == "View" {
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "VC1") as? VC1
self.navigationController?.pushViewController(vc!, animated: true)
}
if item == "View Proposal" {
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "VC2") as? VC2
self.navigationController?.pushViewController(vc!, animated: true)
}
if item == "Post Review" {
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "VC3") as? VC3
self.navigationController?.pushViewController(vc!, animated: true)
}
}
error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally a view controller <UITableViewController: 0x7fdb37092420> that is already being presented by <TestApp.SideMenuController: 0x7fdb36659370>.'
Aucun commentaire:
Enregistrer un commentaire