现在,我只是在纵向模式下执行此操作,方法是使用UIImagePicker以纵向拍摄照片并将其设置为UIView,同时将用户限制为仅限纵向视图 .
但是,我想为此扩展横向功能 . 根据拍摄照片的方式(纵向或横向拍摄),将返回的图像设置为UIView和 present it in the same orientation as the picture was taken. Also constrain the user from switching to a different orientation. (IE:如果图片是横向拍摄的,请将UIView仅在横向上可见 . )
1 回答
试试这段代码:
它会自动改变方向
希望它能帮助你