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!
views:
16answers:
1
A:
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.
Graham Lee
2010-10-20 15:47:40
hey, thanks for the prompt reply :) I have done this for passing value from A to B...but my problem is actually the other way round: How do i set a property that belongs to A before I pop B,from B???
Bangdel
2010-10-20 15:51:26
@Bangdel my bad, I misinterpreted your question. Updated.
Graham Lee
2010-10-20 16:06:11