我将完成两件事。
首先在所有VC上设置主题颜色,然后将我的货币从INR更改为USD,反之亦然。
我将此视图控制器命名为As Settings VC。 1)我将改变VC的主题 2)它会改变,但为此我需要从这个视图控制器返回。它永远不会在这里自动改变。 3)任何人都可以帮助我这样在没有导航任何其他VC的情况下自动更改吗?
我在这里是我的代码......
import UIKit
class SettingsVC: UIViewController {
@IBOutlet weak var themeColorSeg: UISegmentedControl!
@IBOutlet weak var Currency: UISegmentedControl!
override func viewDidAppear(_ animated: Bool){
setThemeOnVC(View: self.view)
}
override func viewDidLoad() {
super.viewDidLoad()
themeColorSeg.selectedSegmentIndex = getTheme()
Currency.selectedSegmentIndex = getCurrency()
}
@IBAction func saveAction(_ sender: Any) {
setTheme(themeCode: themeColorSeg.selectedSegmentIndex)
setCurrency(CurrencyCode: Currency.selectedSegmentIndex)
navigationController?.present(Utilities().configPopup(title: "Saved", message: "Settings Seved Successfully!"), animated: true, completion: nil)
}
}
答案 0 :(得分:0)
在saveAction
上,也添加以下行
setThemeOnVC(View: self.view)