Frage

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];
War es hilfreich?

Lösung

Change the modalPresentationStyle to UIModalPresentationFormSheet.

Instead of

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

Try this

sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top