Saturday, December 9, 2023
HomeiOS Developmentios - Customized nameless closure navigation again button within UiView()

ios – Customized nameless closure navigation again button within UiView()


I’ve a query, how is it doable to implement the creation of a customized again navigation button inside an UIView(). I’ve a most important controller which incorporates a collectionView, clicking on any cell goes to a second controller which incorporates a tableView. I created a separate customized view contained in the tableView headers the place I added labels, photos, buttons. I would like when clicking a backButton inside a customized view, it can go to the principle controller. How may be applied? I making app solely programmatically – (No Storyboard)

CustomView.swift

lazy var backButton: UIButton = {
    let button = UIButton(sort: .system)
    let picture = UIImage(systemName: "chevron.left")
    button.setImage(picture, for: UIControl.State())
    button.tintColor = .white
    button.isHidden = true
    button.addTarget(self, motion: #selector(goToBack), for: .touchUpInside)
    button.translatesAutoresizingMaskIntoConstraints = false
    return button
}()

@objc func goToBack() {
    
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments