문제

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