iOS UIImageView自适应图片大小
来源:互联网 发布:手机论坛软件 编辑:程序博客网 时间:2024/05/29 18:39
窗口大小获取:
CGRect screenBounds = [ [UIScreenmainScreen]bounds];//返回的是带有状态栏的Rect
CGRect rect = [ [UIScreenmainScreen]applicationFrame];//不包含状态栏的Rect
UIImageView:
一 :圆角以及自适应图片大小
UIImage* image = [UIImage imageNamed:@"image.png"];
UIImageView* imageView = [[[UIImageView alloc] initWithImage:image] autorelease];
imageView.frame = CGRectMake(0, 0, 300, 200);
imageView.layer.cornerRadius = 8;
imageView.layer.masksToBounds = YES;
//自适应图片宽高比例
imageView1.contentMode = UIViewContentModeScaleAspectFit;
二 图片自适应UIImageView (来源于:http://www.61ic.com/Mobile/iPhone/201103/29636.html)
- (UIImage *)rescaleImageToSize:(CGSize)size {
CGRect rect = CGRectMake(0.0, 0.0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
[self drawInRect:rect]; // scales image to rect
UIImage *resImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resImage;
}
- iOS UIImageView自适应图片大小
- iOS UIImageView自适应图片大小
- UIImageView自适应图片大小
- UIImageView自适应图片大小
- UIImageView自适应图片大小
- iOS 图片自适应UIImageView
- ios开发-UIImageView适配图片大小
- IOS-UIImageView 图片自适应大小
- ios图片等比例自适应UIImageview
- 图片大小自适应
- 图片大小自适应
- 图片大小自适应
- 图片大小自适应
- 图片大小自适应
- UIImageView处理图片大小问题
- IOS UIWebView 中使用JavaScript 来实现图片大小自适应
- IOS UIWebView 中使用JavaScript 来实现图片大小自适应
- IOS编程之_算法实现UIImageView自适应屏幕大小
- Fragment的public void onAttach(Context context) 没有被调用的问题
- iOS面试题九
- Android从相册中选取图片上传到阿里云OSS
- opencv读取视频
- ZOJ Missile 3460 (最大流+二分)
- iOS UIImageView自适应图片大小
- Bringing up interface eth0: Error: No suitable device found: no device found for connection 'System
- 二叉树系列——二叉树的镜像
- Tomcat 启动GZIP 压缩
- jquery笔记
- 高并发web系统优化总结
- Java过滤器,SpringMVC拦截器之间的顺序关系
- IOS taBbar item角标设置
- 如何将QT程序移植到开发板上运行