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的子类,因此也是视图控件,可以用来显示图像.因为它具有帧动画属性和操作方法,因此可以用来制作动画,其实动画就是很短的时间内,执行显示连续的 ...
随机推荐
- .Net应该学什么怎么学(一)
更新时间:2012年06月05日18时21分 来源:传智播客.Net 上篇<学了.Net做什么开发>中我讲到了目前.Net开发主要方向是Web开发,因此在本篇中我将主要讲解做Web开发要学 ...
- git commit 多行注释方法说明
为了提高项目质量,不仅仅是代码的质量,而且还包括代码管理的质量. 所以,详细的git commit message 必不可少. 现在记录一下git commit 多行详细的commit 信息. 首先, ...
- Extjs 解决在IE 火狐浏览器字体太小问题
<style type="text/css"> *{font-size:12px!important;} </style>
- Android——列表视图 ListView(一)Arrayadapter
一.ArrayAdapter 只显示文字 activitylistview_layout.xml <?xml version="1.0" encoding="utf ...
- C++中声明与定义的区别
如果是指变量的声明和定义: 从编译原理上来说,声明是仅仅告诉编译器,有个某类型的变量会被使用,但是编译器并不会为它分配任何内存.而 定义就是分配了内存.对于下面的两句代码:void Func(){in ...
- LINQ教程三:Lambda表达式解剖
C#3.0(.NET3.5)中引入了Lambda表达式和LINQ.Lambda表达式是使用一些特殊语法表示匿名方法的较短方法. 最基本的Lambda表达式语法如下: (参数列表)=>{方法体} ...
- json格式在ruby和rails中的注意事项
#虚拟网络拓扑的json数据 def topodata #@vnic = Vnic.all #flash.now[:notice] = 'Message sent!' #flash.now[:aler ...
- php面试
var_dump()的作用是什么,主要用来干什么?Thread safe 和 Non Thread Safe 有什么区别?(本人表示不会,从没看见过)用php 把 gbk 的编码的字符串转换成 utf ...
- B2B(企业对企业)、B2C(企业对个人)、C2C(个人对个人)
B2B(企业对企业).B2C(企业对个人).C2C(个人对个人)
- easyui Datagrid+searchbox 实现搜索功能
1.前台页面 <%@ page language="java" pageEncoding="utf-8" isELIgnored="false& ...
