获取本地照片,的尺寸
来源:互联网 发布:au下载 免费中文版mac 编辑:程序博客网 时间:2024/06/11 19:45
NSFileManager * fileManager = [NSFileManagerdefaultManager];
NSString * filePath = [[NSHomeDirectory()stringByAppendingPathComponent:@"/Documents"]stringByAppendingPathComponent:[NSStringstringWithFormat:@"camera%ld.png",currentBtn]];
//path 图片的本地路径
// CGSize size=[UIImage imageWithContentsOfFile:filePath].size;
CGImageRef imageRef = [[UIImage imageWithContentsOfFile:filePath] CGImage];
CGSize size = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));//这个size就是实际图片的像素大小 例如系统相册里的花, {1239,822}
//2、获得屏幕分辨率 scale:
CGFloat scale_screen = [UIScreen mainScreen].scale;
//所以要想展示 imageView上面图片的大小
UIImageView * imgView =[[UIImageViewalloc]init] ;
imgView.center = self.view.center;
imgView.bounds = CGRectMake(0, 0, size.width/scale_screen, size.height/scale_screen);
imgView.image = [[UIImage alloc]initWithContentsOfFile:filePath ];//第二种是苹果官方的
UIImageView * imgView =[[UIImageViewalloc]initWithFrame:CGRectMake(0,0, WIDTH,HEIGHT)] ;
imgView.image = [[UIImagealloc]initWithContentsOfFile:filePath ];
imgView.contentMode =UIViewContentModeScaleAspectFit;// 关于介绍 contentMode : http://blog.csdn.net/annkie/article/details/49247755
[self.view addSubview:imgView];
- 获取本地照片,的尺寸
- Android中调用系统相机获取照片的尺寸问题
- 【生活常识】照片的尺寸
- 照片的常用尺寸规范
- 打开本地相册,获取照片
- 获取本地照片和拍照上传并裁剪的实现
- Fragment获取本地照片显示之Activity 的ontActivityResult()
- iOS---如何获取手机的本地照片和相册
- java获取图片的大小和尺寸(本地& 服务器)
- Android不加载获取网络、本地图片的尺寸
- js在前端获取在本地上传图片的尺寸
- 照片尺寸
- Android开发教程--关于系统相机拍照获取的照片尺寸较小问题的解决
- 一寸照片的尺寸规范
- photoshop中常用照片的尺寸
- Android 获取本地相册照片信息
- 获取照片的uri
- 获取尺寸的写法
- navigationController侧滑返回上一页面(关闭本页面)失效的问题
- Swordsman
- 面向对象设计原则及设计模式概要
- IOS UDP使用
- 数据库事务及其特性
- 获取本地照片,的尺寸
- svn(包含大量大尺寸文件)迁移到git需要考虑的问题
- "ERROR ITMS - 90167 No. app bundles found in the package". - iOS上传应用报错
- c# 中的#define灵活控制代码是否编译
- phpexcel来做表格导出(多个工作sheet)及设置单元格格式
- 网站的静态资源为什么要使用独立域名,竟然对访问性能还有如此大的影响
- iOS10 NavigationController push的时候NavigationBar闪现白条
- OpenCamera源码阅读之XML解析
- TCP、UDP、IP报头结构体