码迷,mamicode.com
首页 > 移动开发 > 详细

IOS大图片处理(附源码)

时间:2015-05-24 20:28:19      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:ios

  • 大图片处理
ViewController.m
--------------------------------------------------
(void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //大图片滑动
    UIScrollView *scrollView = [[UIScrollView alloc] init];
    scrollView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);//设置UIScrollView的可视范围
    scrollView.backgroundColor = [UIColor grayColor];//设置UIScrollView背景颜色为灰色
    [self.view addSubview:scrollView];//加载UIScrollView

    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.image = [UIImage imageNamed:@"xingkong.jpg"];
    CGFloat imgW = imageView.image.size.width;//图片的宽度
    CGFloat imgH = imageView.image.size.height;//图片的高度
    imageView.frame = CGRectMake(0, 0, imgW, imgH);
    [scrollView addSubview:imageView];

    //设置UIScrollView的滚动范围(内容大小)
    scrollView.contentSize = imageView.image.size;
}-

Demo

IOS大图片处理(附源码)

标签:ios

原文地址:http://blog.csdn.net/zhao_fu_lu/article/details/45954189

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!