ipad – 调整ModalViewController的大小并将其定位在iOS 7的中心位置

ipad – 调整ModalViewController的大小并将其定位在iOS 7的中心位置,第1张

概述我试图通过减少其宽度和高度在iPad上显示modalView,但问题是它不是中心对齐的.在iOS 6中它过去工作正常,但在iOS 7中它不是中心对齐的. 以下是我的代码: m_helpQA = [[HelpQAViewController alloc]init]; m_helpQA.modalPresentationStyle = UIModalPresentationFormSheet; 我试图通过减少其宽度和高度在iPad上显示modalVIEw,但问题是它不是中心对齐的.在iOS 6中它过去工作正常,但在iOS 7中它不是中心对齐的.

以下是我的代码:

m_helpQA = [[HelpQAVIEwController alloc]init]; m_helpQA.modalPresentationStyle = UIModalPresentationFormSheet;       [self presentVIEwController:m_helpQA animated:YES completion:NulL]; m_helpQA.vIEw.supervIEw.bounds = CGRectMake(0,350,250);//Dimensions of ModalVIEw.@H_419_14@  

目前我正是这样做的

解决方法 对于iOS 7试试这个:

[self.navigationController presentVIEwController:navigationController animated:YES completion:^{    //Make the modal bigger than normal    navigationController.vIEw.supervIEw.bounds = CGRectMake(0,700,650);}];@H_419_14@  

动画看起来很难看,所以我建议添加一个动画来改进它:

[self.navigationController presentVIEwController:navigationController animated:YES completion:^{    [UIVIEw animateWithDuration:0.3 delay:0 options:UIVIEwAnimationoptionCurveEaseIn animations:^{        //Make the modal bigger than normal        navigationController.vIEw.supervIEw.bounds = CGRectMake(0,650);    } completion:^(BOol finished) {    }];}];@H_419_14@  

还要记住,您需要在vIEwDIDAppear中设置navigationControllers视图的框架,以使内容的大小正确.

总结

以上是内存溢出为你收集整理的ipad – 调整ModalViewController的大小并将其定位在iOS 7的中心位置全部内容,希望文章能够帮你解决ipad – 调整ModalViewController的大小并将其定位在iOS 7的中心位置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1082966.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存