У меня есть кнопка на UIView
, и я хочу инициализировать UIViewcontroller
при нажатии кнопки. Я пытаюсь показать еще один ViewController
при нажатии кнопки, но получаю сообщение об ошибке:
причина: '[setValue: forUndefinedKey:]: этот класс не соответствует значению ключа для кода AboutUser.'
// Protocol in UIView Class
protocol TinderCardDelegate: NSObjectProtocol {
func didInfoButtonTapped()
}
class TinderCard: UIView {
@objc func info_Btn_Action(sender: UIButton) {
print("tap")
delegate?.didInfoButtonTapped()
}
}
// Code in UIViewController
class SwipeViewController: UIViewController
override func viewDidLoad() {
super.viewDidLoad()
}
func btninfoTapped() {
print("tappp")
let storyboard: UIStoryboard = UIStoryboard (name:
"UserProfileInfo", bundle: nil)
let vc: UserInfoViewController =
storyboard.instantiateViewController(withIdentifier:
"UserInfoViewController") as! UserInfoViewController
self.present(vc, animated: false, completion: nil)
}
}
extension SwipeViewController : TinderCardDelegate {
func didInfoButtonTapped() {
print("Button tapped ")
self.btninfoTapped()
}
}