I have a button on an UIView
, and want to initialize a UIViewcontroller
on button click. I am trying to show another ViewController
on button click but I am getting error as :
reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key 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()
}
}
reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key AboutUser.'
Reply : mab be you copy paste button from another controller Please remove action of that class and give action for that class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.