iOS - UIImageView - how to handle UIImage image orientation

Is it possible to setup UIImageView to handle image orientation? When I set the UIImageView to image with orientation RIGHT (it is photo from camera roll), the image is rotated to right, but I want to show it in proper orientation, as it was taken. I know I can rotate image data but it is possible to do it more elegant? Thank you |
|||
If I understand, what you want to do is disregard the orientation of the UIImage? If so then you could do this:
So you're creating a new UIImage with the same pixel data as the original (referenced via its CGImage property) but you're specifying an orientation that doesn't rotate the data. |
|||||||||||||
|


As Anomie suggests in their answer here, this code will help to fix orientation:
|
|||||||||||||||||
|
You can completely avoid manually doing the transforms and scaling yourself, as suggested by an0 in this answer here:
The documentation for the UIImage methods size and drawInRect explicitly states that they take into account orientation. |
|||
here is a workable sample cod, considering the image orientation:
|
iOS - UIImageView - how to handle UIImage image orientation的更多相关文章
- [iOS]UIImageView增加圆角
[iOS]UIImageView增加圆角 "如何给一个UIImageView增加圆角?有几种方法?各自区别?" 备注:本文参考自http://www.jianshu.com/p/d ...
- iOS - UIImageView
前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIImageView : UIView @available(iOS 2.0, *) public class U ...
- iOS UIImageView设置为圆形
UIImageView设置为圆形的方法(效率比较低下,当需要显示很多圆形view的时候,非常不推荐这种方式): imageView.layer.masksToBounds = YES; imageVi ...
- iOS:由URL成员UIImage
很多时候,我们只能得到URL.然后,需要建立一个UIImage. 在正常情况下,.我们一般通过SDWebImage直接施工UIImageVIew的image,如何使用URL直接施工UIImage它? ...
- iOS UIImageView自适应图片大小
窗口大小获取: CGRect screenBounds = [ [UIScreenmainScreen]bounds];//返回的是带有状态栏的Rect CGRect rect = [ [UIScre ...
- ios UIImageView异步加载网络图片
方法1:在UI线程中同步加载网络图片 UIImageView *headview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 4 ...
- ios UIImageView处理图片大小问题
UIImageView视图可以显示图片 实例化UIImageView有两种方法 第一种方法: UIImageView *myImageView = [[ UIImageView alloc] init ...
- iOS - UIImageView 动画
1.UIImageView 动画 1.1 播放图片集 播放图片集 @property (nonatomic, strong) UIImageView *playImageView; self.play ...
- iOS:UIImageView图像视图控件
UIImageView:图像视图控件: 它是UIView的子类,因此也是视图控件,可以用来显示图像.因为它具有帧动画属性和操作方法,因此可以用来制作动画,其实动画就是很短的时间内,执行显示连续的 ...
随机推荐
- 一款纯css3实现的超炫动画背画特效
之前为大家介绍了很多款由纯css3实现的特效.今天要再给大家带来一款纯css3实现的超炫动画背画特效.代码非常简单,没有引用任何其它js代码.css代码也不多.效果非常炫.一起看下效果图: 在线预览 ...
- 【C#/WPF】窗体定时自动关闭
需求:打开WPF项目后,展示3秒钟产品Logo后,进入主界面MainWindow.(类似于安卓应用打开时的闪屏页SplashPage) 思路:在进入MainWindow后新建一个Window窗体,窗体 ...
- git学习(四):理解git暂存区(stage)
与一般的版本管理不同的是,git在提交之前要将更改通过git add 添加到暂存区才能提交(git commit).即使是已经交给了git来管理的文件也是如此.这里继续学习git的暂存区. 通过git ...
- 单网卡绑定多个ip, 多个网卡绑定成一块虚拟网卡
Linux网卡配置与绑定 Redhat Linux的网络配置,基本上是通过修改几个配置文件来实现的,虽然也可以用ifconfig来设置IP,用route来配置默认网关,用hostname来配置主机 ...
- iOS边练边学--(Quartz2D)图片裁剪,带圆环的裁剪
一.图片裁剪,示意图 二.带圆环的图片裁剪示意图
- tp-03 模板显示
方式模板:$this->display(); 每当建立一个控制器 都要在view建立一个名字相对应的文件夹 在建立相对于的页面.
- easyui中datagrid用法,加载table数据与标题
加载标题写法: 多行标题:columns: [[ columns: [[ { field: 'itemid', title: 'Item ID', rows ...
- 关于Cocos2d-x中节点的获取
方法一: 1.在.h文件的属性里面先声明要使用的节点或者变量. private: Label *scorelabel; 2.在.cpp文件中创建并使用这个节点或者变量. scorelabel = La ...
- Android ArryaList 笔记
Arraylist相当于动态数组,可以动态的添加或者删除其中的元素. 参考链接 http://beginnersbook.com/2013/12/java-arraylist/ package com ...
- The configuration file 'appsettings.json' was not found and is not optional
问: .Net Core: Application startup exception: System.IO.FileNotFoundException: The configuration file ...