Saturday, May 2, 2026
HomeiOS Developmentios - navigate from customized view to contoller?

ios – navigate from customized view to contoller?

[ad_1]

*That is my customized view. I’ve a button “nextButton” . I cant navigate to new viewcontoller as a result of xcode has error “Worth of sort ‘CustomView’ has no member ‘navigationController”. How am i able to repair?

class CustomView : UIView {


var nextButton : UIButton = {

    let button = UIButton(body: CGRect(x: 130, y: 190, width: 100, peak: 50))
      button.backgroundColor = .systemGreen
      button.setTitle("Subsequent", for: .regular)
    button.addTarget(CustomView.self, motion: #selector(nextButtonpressed), for: .touchUpInside)


return button } ()



@objc  func nextButtonpressed() {
let detailVC = ViewController()
self.navigationController.pushViewController(detailVC, animated: true)

}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments