I want to present a pop up in the Tableview cell ViewController. I want this because in the TableViewCell is an button that needs a pop up when it is pressed. Please help me! If I run this I get the error:
InstagramClone.SignInViewController: 0x102e22b30 whose view is not in the window hierarchy!
@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)
}
}