I can think of a couple ways to handle this.
First, reconsider your choice to use two different VCs to handle orientation changes. How hard would it be to update the UI on your first VC to look appropriate in portrait?
Second, abstract the data out into a struct or a class so that you can pass it back and forth between your two VCs
@interface MyDataStorage : NSObject {
NSString* text1;
NSString* text2;
NSString* text3;
NSString* text4;
}
Lastly, you could create a protocol to keep the two VCs in sync:
@protocol VCSync : NSObject {
- (void)updateTextBox1:(NSString*)contents;
- (void)updateTextBox2:(NSString*)contents;
...
}
You would need to keep references to the other VC so that you can call the appropriate method from your TextBox delegate callbacks.
RE: Documentation link
If you're referencing this passage: There are better ways to provide unique views for different orientations, such as presenting a new view controller
then you should read the previous sentence.
A new VC is only suggested if you're swapping out your entire view hierarchy. If you are only resizing the textboxes then I would just write the code to do so in willAnimateRotationToInterfaceOrientation:duration:
since then you won't have to move any of the information from one VC to another.
If you still decide to go ahead with another VC then I would create a class which just contains a bunch of NSString
s or NSAttributedString
s as your needs dictate. You would then need a method on each of your VCs which goes something like:
- (void)updateTextboxesWithData:(MyDataStorage*)data {
for(UITextbox in self.textboxes) {
t.text = data.string;
}
}