iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ipad – 调整ModalViewController的大小并将其定位在iOS 7的中心位置大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图通过减少其宽度和高度在iPad上@L_734_0@modalView,但问题是它不是中心对齐的.在iOS 6中它过去工作正常,但在iOS 7中它不是中心对齐的.

以下是我的代码

@H_649_9@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.

目前我正是这样做的

解决方法

对于iOS 7试试这个:

[self.navigationController presentViewController:navigationController animated:YES completion:^{
    //Make the modal bigger than normal
    navigationController.view.superview.bounds = CGRectMake(0,700,650);
}];

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

[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) {
    }];
}];

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

大佬总结

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

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。