iOS8 unable to re-size the modal form sheet after

2019-03-16 15:27发布

问题:

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?.

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);

回答1:

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



标签: ios ipad ios8