I have accounts which they have some settings attributes. As settings there are value of UISlider and value of UISwitch. When i run the application it works fine i can display the last value from NSUserDefaults because viewDidLoad method works. My application has a tab bar controller by the way. So when i switch tabs it works fine too because i can get the values of switch and slider and update them in viewWillAppear method. But in my setting switch, i present a view which there are user list in it, so the user can select any account. When i get back from presented view i can’t update the values of switch and slider. I need a trigger method to update their values. Is there any way to do that?
I have accounts which they have some settings attributes. As settings there are value
Share
Yes this are the 3 apple ways to do it:
However for your particular case a modal view, the delegation pattern is the one Apple recommends, and is the one I would recommend as well.
It requires a bit more coding than the other 2 options though.
First you have to declare the protocol in the view you are presenting modally:
Then before presenting the modal view modally from the original view controller simply set the delgate like this
Then have your presenting view controller adopt the protocol
Finally when user presses “Done”
you can call
And update accordingly.
Hope that helps.