UIImagePickerController Image Orientation

前端 未结 3 514
挽巷
挽巷 2020-12-16 07:50

Can anyone tell me how to use the UIImagePickerController (camera and album) delegates determine the image\'s orientation, rotate accordingly, and assign it to a UIImageView

3条回答
  •  太阳男子
    2020-12-16 08:44

    Vodkhang's answer is partially incorrect - modern cameras put an explicit orientation into the image when they take the photo. This has been common for about 5+ years now.

    I've previously used the code in this answer to do the rotation by reading the "orientation" info direct from the picture:

    UIImagePickerController camera preview is portrait in landscape app

提交回复
热议问题