2016-02-08 8 views
5

में नहीं बुलाया मैं एक UITabBarController उपवर्ग है और यह नीचे दिए गए कोड है:supportedInterfaceOrientations आईपैड

class TabBarController: UITabBarController { 

// MARK: Methods 

override func viewDidLoad() { 

    super.viewDidLoad() 

} 

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { 

    print(self.selectedIndex) 
    if self.selectedIndex == 1 { 
     return .Portrait 
    } 

    return .All 


    } 

} 

समारोह supportedInterfaceOrientations केवल कहा जाता है जब मैं एक iphone से एप्लिकेशन को निष्पादित करें। अगर मैं अपने आईपैड मिनी से ऐप निष्पादित करता हूं तो इसे नहीं कहा जाता है। इस व्यवहार के कारण का कोई विचार?

उत्तर

25

यह बहुत अजीब है, लेकिन अगर मैं iPads supportedInterfaceOrientations के डिवाइस अभिविन्यास से Upside Down को अचयनित करता हूं।

enter image description here

अद्यतन: 'पूर्ण स्क्रीन आवश्यक है' से 'सामान्य' की स्थापना

हैं, तो सक्षम है उन्मुखीकरण प्रतिनिधि तरीकों shouldAutorotate, preferredInterfaceOrientation, और supportedInterfaceOrientations आग करने की अनुमति देगा।

+0

YIRequiresFullScreen को YES में सेट करना मतलब है कि ऐप अब मल्टीटास्किंग का समर्थन नहीं करता है। मामले का उपयोग करने के आधार पर यह एक अच्छा विचार नहीं हो सकता है। Https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html#//apple_ref/doc/uid/TP40015145-CH13-SW1 देखें – Klaas