In my project i have created two UIView
one for landscape mode and the other for potrait mode. I am using the same same UIViewController
to control both these views. These two views have the same content, only thing is that when i switch from one UIView
to another the value of the UIControls
is not retained. I have loaded the UIView enter code here
using the following code
NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"UIViewName"
owner:self
options:nil];
UIView *lview = (UIView *)[nibArray objectAtIndex:0];
lview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.jpg"]];
self.view = lview;
Can anybody pliz help me retaining the values during orientation change?
You can stock all the values on a NSMutableDictionary in your controller and then put the inputs of the user on the reloaded views when the user changes the orientation.
Look here at theh documentation to see how NSMutableDictionary works:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.