1

I am working on an iOS app using iOS 8 and the new PhotoKit, I iterate over user images and I am trying to find out via code whether an image is vertical or horizontal? is there a flag I can inspect on the asset?

Huang
  • 1,355
  • 2
  • 11
  • 28

2 Answers2

1

Probably not the best response but maybe it can help:

You can check if pixelWidth of PHAsset object is larger than pixelHeight to detect if it is horizontal or not. You can also write category in order to provide a flag which is BOOL to make your code looks cleaner.

Mert Buran
  • 2,989
  • 2
  • 22
  • 34
1

You can use requestImageForAsset:targetSize:contentMode:options:resultHandler: to request a image and get its orientation through imageOrientation property. See the doc here requestImageForAsset.

gabbler
  • 13,626
  • 4
  • 32
  • 44