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的子类,因此也是视图控件,可以用来显示图像.因为它具有帧动画属性和操作方法,因此可以用来制作动画,其实动画就是很短的时间内,执行显示连续的 ...
随机推荐
- js中定义属性和变量
//定义数组 var arr = []; //定义对象 var obj = {}; //定义正则表达式 var reg = /../;
- R ggplot2 线性回归
摘自 http://f.dataguru.cn/thread-278300-1-1.html library(ggplot2) x=1:10y=rnorm(10)a=data.frame(x= x, ...
- wireshark error: There are no interfaces on which a capture can be done.
一.Linux环境:1.root用户启动 01.启动一个shell 02.sudo wireshark (需要root权限) 2.普通用户启动 从Linux中第一次启动Wireshark的时候,可能会 ...
- hadoop 1.1.2和 hive 0.10 和hbase 0.94.9整合
今天弄了一下hive0.10和hbase0.94.9整合,需要设置的并不多,但是也遇到了一些问题. 1.复制jar包 拷贝hbase-0.94.9.jar,zookeeper-3.4.5.jar,pr ...
- 实现整数转化为字符串函数itoa()函数
函数原型: char *itoa( int value, char *string,int radix);原型说明:value:欲转换的数据.string:目标字符串的地址.radix:转换后的进制数 ...
- 探索Java语言与JVM中的Lambda表达式
Lambda表达式是自Java SE 5引入泛型以来最重大的Java语言新特性,本文是2012年度最后一期Java Magazine中的一篇文章,它介绍了Lamdba的设计初衷,应用场景与基本语法.( ...
- 25个非常实用的jQuery/CSS3应用组件
今天分享25款功能十分强大的jQuery/CSS3应用插件,欢迎收藏. 1.jQuery水晶样式下拉导航 这是一款非常不错的jQuery多功能下拉菜单插件,菜单外观呈水晶样式,晶莹剔透,功能丰富,包含 ...
- 更改windows 2003远程桌面端口3389为其他的端口号【转】
众所周知,windows 2003远程终端服务基于默认端口3389.入侵者一般先扫描主机开放端口,一旦发现其开放了3389端口,就会进行下一步的入侵,所以我们只需要修改该务默认端口就可以避开大多数入侵 ...
- (转)x264代码详细阅读之x264.c,common.c,encoder.c
转自:http://alphamailpost.blog.163.com/blog/static/201118081201281103931932/ x264代码详细阅读第一之x264.chttp:/ ...
- 转)tslib机制分析
估计大家都听说过tslib,其实从他的名字就可以看出它的,它是touchscreen的lib,其实这样还不够具体,其实它开始确实是为了touchscreen的鼠标驱动而发展起来的,且只是一个中间处理库 ...
