你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> IOS大圖片處理(附源碼)

IOS大圖片處理(附源碼)

編輯: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

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved