生活随笔
收集整理的這篇文章主要介紹了
01-UIScrollView01-大图片展示
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
?
源代碼下載鏈接:01-UIScrollView01-大圖片展示.zip
283.7 KB
////? MJViewController.m//? 01-UIScrollView01-大圖片展示////? Created by apple on 13-11-27.//? Copyright (c) 2013年?itcast. All rights reserved.//
#import?"MJViewController.h"
@interface?MJViewController ()
@end
@implementation?MJViewController
- (void)viewDidLoad{? ? [super?viewDidLoad];? ??? ? UIScrollView *scrollView = [[UIScrollView alloc] init];? ? scrollView.frame = CGRectMake(0,?0,?250,?250);?//?指UIScrollView的可視范圍? ? scrollView.backgroundColor = [UIColor grayColor];? ? [self.view addSubview:scrollView];? ??? ? UIImageView *imageView = [[UIImageView alloc] init];? ? imageView.image = [UIImage imageNamed:@"big.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;?? ??//?隱藏水平滾動條? ? scrollView.showsHorizontalScrollIndicator =?NO;? ? scrollView.showsVerticalScrollIndicator =?NO;? ??? ??//?去掉彈簧效果//??? scrollView.bounces = NO;? ??? ??// top? left? bottom? right? ? scrollView.contentInset = UIEdgeInsetsMake(10,?20,?40,?80);}
@endhttps://www.evernote.com/shard/s227/sh/5e562326-d7af-4b51-8134-42fa544fd979/786f6301ad10be5c5ae80ba3bef5031a
轉載于:https://www.cnblogs.com/ChenYilong/p/3491040.html
總結
以上是生活随笔為你收集整理的01-UIScrollView01-大图片展示的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。