Reputation: 725
I have a main view. From that main view I show a modal view (MV1). MV1 show another modal View (MV2).
*mainview coding:-
MV1 *MV1obj = [[MV1 alloc]initWithNibName:@"MV1" bundle:nil];
MV1obj.modalPresentationStyle=UIModalPresentationPageSheet;
[self presentModalViewController:MV1obj animated:YES];
MV1obj.view.superview.frame = CGRectMake(0, 0,730,620);
MV1obj.view.superview.center = self.view.center;
When I click on button in mainview, MV1 modelview is open and its width and height is 730 and 620. MV1 modelview contain one imagebutton. When I clicked on this button MV2 model view is open and display full screen image in model view Mv2.
*MV1 class coding:-
MV2 *MV2obj = [[MV2 alloc]initWithNibName:@"MV2" bundle:nil];
MV2obj.modalPresentationStyle=UIModalPresentationFullScreen;
[self presentModalViewController:MV2obj animated:YES];
But when I dissmiss model view Mv2, Mv1 model view is displayed in full screen. But I need to display Mv1 model view in 730 width and 620 height. Can anyone tell me what is the problem with code?
Thanks.
Upvotes: 3
Views: 870
Reputation: 29767
Solved by explicitly setting center and frame once again. Write these lines into MV2
class when you dismiss self
:
-(IBAction)logoClick:(UIButton*)sender{
[self dismissModalViewControllerAnimated:YES];
UIViewController *vc = [self parentViewController]; // it's your MV1 instance
vc.view.superview.frame = CGRectMake(0, 0, 730, 620);
vc.view.superview.center = CGPointMake(1024/2, 768/2);
}
Upvotes: 2