سؤال

لدي 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 (كلاهما يحتاج إلى الاتفاق على التوجهات التي يدعمونها).

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