出现在tableview单元格中弹出

时间:2018-04-11 11:35:03

标签: swift uitableview popup

我想在Tableview单元格ViewController中弹出一个弹出窗口。我想要这个,因为TableViewCell是一个按下时需要弹出的按钮。请帮我!如果我运行这个我得到错误:

  

InstagramClone.SignInViewController:0x102e22b30,其视图不是   在窗口层次结构中!

@objc func kik (){
        if let Kik = user?.KikUsername {
            // Prepare the popup assets
            let title = "Kik Username"
            let message = "The Kik username from \(user?.username) is: \(Kik)."
            let image = UIImage(named: "kik-icon.jpg")

            // Create the dialog
            let popup = PopupDialog(title: title, message: message, image: image)

            // Create buttons
            let buttonOne = CancelButton(title: "Cancel") {
                print("You canceled")
            }

            // This button will not the dismiss the dialog
            let buttonTwo = DefaultButton(title: "Copy Kik Username to clipboard!", dismissOnTap: false) {
                UIPasteboard.general.string = Kik
            }
            popup.addButtons([buttonOne, buttonTwo])

            // Present dialog
            self.window?.rootViewController?.present(popup, animated: true, completion: nil)
        }

    }

1 个答案:

答案 0 :(得分:0)

我认为您只需要将弹出窗口添加到主视图中:

new BigDecimal(-0D)