2015-04-27 62 views

回答

1

試試這個:

var orientation: UIDeviceOrientation = currentDevice.orientation 

    if orientation.isLandscape { 
     // do something 
    } else { 
     // do something 
    } 

,當設備旋轉,你可以使用這個..

override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) { 

    if toInterfaceOrientation == UIInterfaceOrientation.Portrait { 
     // do something 
    } else { 
     // do something 
    } 
} 
+1

哇...多數民衆贊成在propt答案 –

+0

HAAA HAA沒有問題,我新的迅速以及。在這裏學習很多,所以試圖幫助我的同胞新手;) –