2015-06-22 52 views

回答

3

只是檢查的UIImage

image.imageOrientation 

更多細節此屬性,讀這document

+0

imageOrientation屬性提供有關其旋轉狀態的信息,而不是它是橫向還是縱向圖像。 – Imotep

1

簡單地檢查它的大小:

UIImage* myImage = ...; 
if (myImage.size.width > myImage.size.height) 
{ 
    //landscape 
} 
else 
{ 
    //portrait 
} 
1

遵循以下步驟:

  1. 待辦事項下載完整的圖像。
  2. 獲取寬度&動態的高度。
  3. 現在發現它比

如果(寬/高> 1)

// you can consider it as Landscape Image. 

其他

// you can consider it as Portrait Image. 

請讓我知道你是否需要再澄清。

0

只需通過這些條件檢查圖像的寬度和高度..

UIImage* yourImg = @"imgName"; 

if (yourImg.size.width > yourImg.size.height) 
{ 
    //yourImg is Landscape 
} 
else 
{ 
    //yourImg is Portrait 
} 
相關問題