ios - How to check if device orientation is landscape left or right in swift? -


    if uideviceorientationislandscape(uidevice.currentdevice().orientation) {         print("landscape")     }     if uideviceorientationisportrait(uidevice.currentdevice().orientation){         print("portrait")     } 

how can check if it's landscape left or right?

you can like,

if uidevice.currentdevice().orientation == uideviceorientation.landscapeleft{  } else if uidevice.currentdevice().orientation == uideviceorientation.landscaperight{  } else if uidevice.currentdevice().orientation == uideviceorientation.uideviceorientationportraitupsidedown{  } else if uidevice.currentdevice().orientation == uideviceorientation.uideviceorientationportrait{  } 

swift 3

if uidevice.current.orientation == uideviceorientation.landscapeleft {  } else if uidevice.current.orientation == uideviceorientation.landscaperight {  } else if uidevice.current.orientation == uideviceorientation.portrait {  } else if uidevice.current.orientation == uideviceorientation.portraitupsidedown {          }  

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -