Question

I have used this code in iOS 6 and I can present another view in the middle of main view. However, when I run in iOS 7, that presented view's origin is always at 0,0. How shall I do?

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];
Was it helpful?

Solution

Change the modalPresentationStyle to UIModalPresentationFormSheet.

Instead of

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

Try this

sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top