更改方向后,iOS8无法重新调整模态表单的大小 [英] iOS8 unable to re-size the modal form sheet after changing the orientation

查看:168
本文介绍了更改方向后,iOS8无法重新调整模态表单的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


实际上我正在做的是在iPad上我正在使用我自己的尺寸(520 X 400)呈现模态形式
。它第一次工作正常。
然后,当我旋转(纵向到横向或横向到纵向)
我的模态表单更改为ios默认大小。此外,我无法通过编程方式再次更改模态表单大小
。因为,
一旦定向改变ios使我的(520X400)模态表单
为其默认大小。知道怎么解决这个问题吗?。

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

注意:


当我在ios7设备上运行时,我发现以下代码的
没有任何问题。如果我的代码有任何问题,请说明
me。因为我不知道ios8有什么问题

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

这是我用来更改模态表单大小的代码:

self.navigationController.view.superview.frame = CGRectMake(200, 220, 400, 605);


推荐答案

最后我想办法如何解决上述问题一。

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

这里我的解决方案:

在ios8上只需将以下属性设置为模态视图即可解决问题

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

在视图中加载:

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

我希望这有助于

这篇关于更改方向后,iOS8无法重新调整模态表单的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆