iPhone - اتجاه الواجهة عكس؟
-
21-09-2019 - |
سؤال
مرحبًا ، لدي هذه القطعة من الكود ...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
و
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
// WTF, this runs when I change to Landscape
} else {
// this runs when I change to Portrait??? shouldn't it be the contrary?
}
}
كما ترى ، يتم تشغيل الرمز في الاتجاه المعاكس ، وأعني ، الجزء الذي يجب تشغيله عندما أقوم بتغيير الجهاز إلى صورة ، وجزء المشهد من الكود والعكس بالعكس.
عندما أقلب الجهاز ، تدور Self.view.
هل اختبار uiinterfaceorientationisportrait هذا كيف تكون الواجهة قبل الدوران أم أنني أفتقد شيئًا؟
شكرا على اي مساعدة.
المحلول
لاحظ أن الطريقة تدعى didrotateمنالواجهة ، لذلك بطبيعة الحال interfaceOrientation
المعلمة تحتوي على الاتجاه القديم ، وليس الجديد.
لا تنتمي إلى StackOverflow