سؤال

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];
هل كانت مفيدة؟

المحلول

Change the modalPresentationStyle to UIModalPresentationFormSheet.

Instead of

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

Try this

sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top