Ran*_*jit 6 ipad modalviewcontroller presentmodalviewcontroller ios7
我试图通过减少其宽度和高度在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, 0, 350, 250);//Dimensions of ModalView.
Run Code Online (Sandbox Code Playgroud)
目前我正是这样做的

你需要将框架居中,这样应该可以工作(我没有测试过)。
CGRect appFrame = [UIScreen mainScreen].applicationFrame;
CGRect modalFrame = m_helpQA.view.superview.frame;
modalFrame.size = CGSizeMake(350.f, 250.f);
modalFrame.origin.x = appFrame.size.width/2.0f - modalFrame.size.width/2.0f;
modalFrame.origin.y = appFrame.size.height/2.0f - modalFrame.size.height/2.0f;
m_helpQA.view.superview.frame = modalFrame;
Run Code Online (Sandbox Code Playgroud)
更新代码以纠正拼写错误
| 归档时间: |
|
| 查看次数: |
2984 次 |
| 最近记录: |