Access container view child properties swift

后端 未结 4 898
悲&欢浪女
悲&欢浪女 2021-02-12 04:18

What I want to achieve:

User presses the button in the ViewController then, the color of the button placed in the container view should change its color to red.

4条回答
  •  迷失自我
    2021-02-12 04:48

    Swift 3 for macOS:

    // MARK: - Container View Controller
    
    var containerViewController: ContainerViewController?
    
    let containerSegueIdentifier = "Container Segue"
    
    override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
        if segue.identifier == containerSegueIdentifier {
            if let connectContainerViewController = segue.destinationController as? FormationViewController {
                formationViewController = connectContainerViewController
            }
        }
    }
    

    Check identifier and controller class.

提交回复
热议问题