gpt4 book ai didi

ios - 将 Action 从 1 个 View Controller 转移到另一个

转载 作者:行者123 更新时间:2023-11-28 14:25:36 25 4
gpt4 key购买 nike

is the MAIN VIEW containing the Container我在 viewcontroller 的 containerView 上有一个按钮(procceed)。点击“procceed”需要显示放置在主视图上的另一个按钮的颜色变化,上述前者是其中的一部分。

is the CONTAINER view having the button procceed

最佳答案

我建议像这样使用 NotificationCenter:

ContainerViewController.swift

NotificationCenter.default.post(name: NSNotification.Name(rawValue: "updateButtonColor"), object: nil, userInfo: nil)

MainViewController.swift

NotificationCenter.default.addObserver(self, selector: #selector(self.updateColor), name: NSNotification.Name(rawValue: "updateButtonColor"), object: nil)


@objc func updateColor() {

CartButton.tintColor = .green

}

关于ios - 将 Action 从 1 个 View Controller 转移到另一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51613846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com