我使用了新的自適應「存在酥料餅」的iOS 8的能力我在故事板做演示有線了一個簡單的SEGUE。它適用於iPhone 6 Plus,因爲它將視圖呈現爲彈出窗口,在iPhone 4上顯示爲全屏視圖(表單樣式)。的iOS 8 presentationController確定是否真的是酥料餅
問題是,當顯示爲全屏視圖,我需要添加「完成」按鈕的視圖,以便dismissViewControllerAnimated可以被調用。當它顯示爲彈出窗口時,我不想顯示「完成」按鈕。
我試圖尋找在兩個presentationController和popoverPresentationController的屬性,我能找到什麼,告訴我,如果它實際上是被顯示爲酥料餅。
NSLog(@"View loaded %lx", (long)self.presentationController.adaptivePresentationStyle); // UIModalPresentationFullScreen
NSLog(@"View loaded %lx", (long)self.presentationController.presentationStyle); // UIModalPresentationPopover
NSLog(@"View loaded %lx", (long)self.popoverPresentationController.adaptivePresentationStyle); // UIModalPresentationFullScreen
NSLog(@"View loaded %lx", (long)self.popoverPresentationController.presentationStyle); // UIModalPresentationPopover
adaptivePresentationStyle總是返回UIModalPresentationFullScreen和presentationStyle總是返回UIModalPresentationPopover
當在UITraitCollection我沒有找到一個名爲「_UITraitNameInteractionModel」時,它實際上顯示爲酥料餅這是隻設置爲1特質期待。但是,Apple不通過popoverPresentationController的traitCollection提供對該特徵的直接訪問。
您是否找到解決方案了? – Bruce 2015-08-02 07:02:21
我認爲羅布格拉西的回答是最完整的。但是,蘋果應該提供一個更簡單的方法來做到這一點。 – 2015-09-27 05:35:18
@TodCunningham蘋果提供了一個簡單的方法,請參閱我的答案。 – malhal 2016-03-01 13:45:01