【代码笔记】iOS-图片旋转
2024-09-23 18:56:59
代码:
RootViewController.h
#import <UIKit/UIKit.h> @interface RootViewController : UIViewController @end
RootViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view. UIImage * image = [UIImage imageNamed:@"1.jpg"];
NSData * tempData;
if (UIImagePNGRepresentation(image)) {
tempData = UIImagePNGRepresentation(image);
NSLog(@"%@",tempData);
}
else{
tempData = UIImageJPEGRepresentation(image, 1);
}
CIImage * iImg = [CIImage imageWithData:tempData];
UIImage * tImg = [UIImage imageWithCIImage:iImg scale:1 orientation:UIImageOrientationRight];
NSLog(@"%@",UIImagePNGRepresentation(tImg));
UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 200, 200, 80)];
imageView.image = tImg;
[self.view addSubview:imageView]; }
最新文章
- 加深一下BlockingQueue的认识
- iOS如何彻底避免数组越界
- Dijkstra算法
- HDU 1536 S-Nim SG博弈
- linux中运维相关命令
- Java Collection框架详解
- Java for LeetCode 199 Binary Tree Right Side View
- 关于Entity Framework 5 从数据库生成模型时没有字段注释的解决方法!
- 数据库安全之TDE列加密
- JQuery 1.3.2联动获取部门
- RecyclerView android
- python基础杂记
- [面试]synchronized
- 根据SQL_ID查询并杀会话
- C#遍历文件夹下面所有指定格式文件
- MySQL大表DROP删除小技巧(转)
- JavaScript工具函数集
- Dell PowerEdge R630服务器VMware ESXI6.0服务器安装
- SQLite 编译错误 - 试图加载格式不正确的程序
- 百度UEditor富文本编辑器去除过滤div等标签
热门文章
- xUnit安装及注意事项
- Python补充06 Python之道
- CSS3制作心形头像
- 高级javascript---原型和原型继承
- 使用Spire组件抛出异常The type initializer for &#39;spr857&#39; threw an exception
- 如何使用免费PDF控件从PDF文档中提取文本和图片
- ORA-01439: 要更改数据类型, 则要修改的列必须为空
- Oracle Recovery 01 - 常规恢复之完全恢复
- iOS_UIImage_毛玻璃效果
- 函数----Beginning Visual C#