ios7 presentviewcontroller无法设置框架

时间:2014-05-07 08:39:17

标签: ios uiview uiviewcontroller presentviewcontroller

我在iOS 6中使用过此代码,我可以在主视图中间显示另一个视图。但是,当我在iOS 7中运行时,显示视图的原点始终为0,0。我该怎么办?

rect= CGRectMake((self.view.bounds.size.width/2)-300,(self.view.bounds.size.height/2)-200,600,400);
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:sVCiPad animated:YES completion:nil];
[sVCiPad.view setFrame:rect];

1 个答案:

答案 0 :(得分:1)

modalPresentationStyle更改为UIModalPresentationFormSheet

而不是

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

试试这个

sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;