I am using a navigation view controller to handle two view controllers; one each for the landscape and portrait orientations.
Now, I need to set a propery belonging to the view controller A(for vertical) that pushed the view controller B (for horizontal), from the view controller B.
Is there any way I can achieve this?
Sample codes and examples are welcome 🙂
Thanks!
I am using a navigation view controller to handle two view controllers; one each
Share
To get from A to B:
Define a property on view controller B to house the variable. In the code where you create view controller B, before you push it, set the property to A’s value.
To get from B to A:
when you create B, use
addObserver:forKeyPath:options:context:to add A as an observer of the property on B. Then when B changes, you get a change notification, and you can update the property on A. See the KVO section here.