Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS8 unable to re-size the modal form sheet after changing the orientation

Tags:

ios

ios8

ipad

Actually what i am doing is on iPad i am presenting the modal form sheet with my own size (520 X 400). It was working fine at first time. Then when i do rotate (portrait to landscape or landscape to portrait) my modal form sheet changed to ios default size. Also, i was not able to change the modal form sheet size again by programatically. Since, once the orientation changed ios making my (520X400) modal form sheet to its default size. Any idea how to fix this?.

screenshot when i am presenting my modal at first time

screenshot when i changed the device orientation

Note:

When i ran on ios7 device i not am seeing any issue with the following code. If any thing wrong with my code then please indicate me. Since i do not know what's wrong with ios8

Here is the code that was i used to change the modal form sheet size:

self.navigationController.view.superview.frame = CGRectMake(200, 220, 400, 605);
like image 988
loganathan Avatar asked Sep 11 '14 12:09

loganathan


1 Answers

finally i figure out a way how to resolve the above one.

Here my solution:

on ios8 just setting the following property to your modal view will resolve the issue

in view did load:

CGRect rect = self.navigationController.view.superview.bounds;
rect.size.width = 605;
rect.size.height = 350;
self.navigationController.view.superview.bounds = rect;
self.navigationController.preferredContentSize = CGSizeMake(605, 350);

before presenting your modal view

your_modal_view.preferredContentSize = CGSizeMake(540.0f, 620.0f) //what ever the size you want

I hope this helps

like image 139
loganathan Avatar answered Oct 18 '22 08:10

loganathan