gpt4 book ai didi

ios - 当进入预览 View Controller 时,contanerview 颜色不会改变

转载 作者:行者123 更新时间:2023-11-29 06:01:22 26 4
gpt4 key购买 nike

当我转到第二个 View 并关闭并进入第一个 View Controller 然后协议(protocol)正常工作时,我有两个 View Controller ,我已经在前一个 Controller 中获得了数据,但没有一个 Controller 标题充电器或不更改 UIview 的背景颜色。

我已经设置了这种类型的方法,但背景颜色或按钮标题仍然没有改变。

这不是完整的代码,而是用于理解的示例。

    //FirstViewcontroller
class First : UIViewController, passData {

func test(test: ApiData) {
self.view.setNeedsDisplay()
self.containerView.backgroundColor = .red
}

// Present secondviewcotroller from this viewcontroller
}

//SecondViewcontroller
protocol passData{
func test(test : ApiData)
}

class Second : UIViewController {

//Dismisss seconviewcontrolller
self.dismiss(animated: true) {
self.delegateSelectMusic.audioData = tempData
}
}

我在关闭时已经获得了数据,但未在我的标签和按钮中设置。

最佳答案

按照这个。

//第一个 View Controller

    // container view object 

private var recommendationsFilterFilterVC: RecommendationsFilterViewController!

// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.

switch segue.identifier! {
case "RecommendationsFilterViewController":

self.recommendationsFilterFilterVC = (segue.destination as! RecommendationsFilterViewController)
self.recommendationsFilterFilterVC.delegate = self

default:
break
}
}


// Call Delegate Method

//MARK: UICropProfileFilterView Delegate

extension ShowRecommendationsViewController : RecommendationsFilterDelegate {
func hideAndShowRecommendationsFilterView(arrRecommendationFilter: [JSON]) {
viewTranslate.isHidden = true
containerFilterView.isHidden = true
self.arrRecommendationList .removeAll()
self.arrRecommendationList = arrRecommendationFilter
self.tblRecommedationList.reloadData()
}

}

//第二个 View Controller

protocol RecommendationsFilterDelegate: class {
func hideAndShowRecommendationsFilterView(arrRecommendationFilter:[JSON])
}

//MARK:变量

weak var delegate: RecommendationsFilterDelegate?


@IBAction func onBack(_ sender: Any) {
self.delegate?.hideAndShowRecommendationsFilterView(arrRecommendationFilter: object["data"]["recordDetails"].arrayValue)
}

关于ios - 当进入预览 View Controller 时,contanerview 颜色不会改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54648259/

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