عرض مشروط باستخدام uimodalpresentationformsheet يظهر خارج الشاشة
-
28-09-2019 - |
سؤال
لدي uiviewController الذي ينفذ
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
ثم ، أحاول أن أظهر وسيطًا فوق هذا العرض:
ModalViewController *modalViewController = [[ModalViewController alloc] init];
modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[mainViewController presentModalViewController:modalViewController animated:YES];
إذا قمت بتشغيل Modal أثناء وجود iPad في صورة ، فإنه يعمل بشكل جيد. ولكن عندما أحتفظ به في المناظر الطبيعية وأحاول إطلاق الوسائط ، تظهر الوسائط نصف الشاشة إلى الجزء العلوي الأيمن من iPad. أيه أفكار؟
المحلول
في ModalViewController ، تنفذ shouldAutorotateToInterfaceOrientation
بنفس الطريقة التي يوجد بها في MainViewController (كلاهما يحتاج إلى الاتفاق على التوجهات التي يدعمونها).
لا تنتمي إلى StackOverflow