Access container view child properties swift

后端 未结 4 1624
情书的邮戳
情书的邮戳 2021-02-12 04:20

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:45

    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.

提交回复
热议问题