1

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];
Larme
  • 24,190
  • 6
  • 51
  • 81
Khant Thu Linn
  • 5,905
  • 7
  • 52
  • 120

1 Answers1

1

Change the modalPresentationStyle to UIModalPresentationFormSheet.

Instead of

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

Try this

sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;
Kumar KL
  • 15,315
  • 9
  • 38
  • 60