[转载]scrollview里面多张图片,每张都能放大缩小
(2016-01-13 10:24:57)
标签:
转载 |
分类: 计算机相关 |
虽然写的代码有些乱,但是我的确靠它转换成了多张图片随意放大缩小的功能。
原文地址:scrollview里面多张图片,每张都能放大缩小作者:茶壶
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor= [UIColor whiteColor];
UITapGestureRecognizer *doubleTap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired:2];
self.imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 980)];
self.imageScrollView.backgroundColor = [UIColor clearColor];
self.imageScrollView.scrollEnabled = YES;
self.imageScrollView.pagingEnabled = YES;
self.imageScrollView.delegate = self;
self.imageScrollView.contentSize = CGSizeMake(768*array.count, 980);
for (int i = 0; i
UITapGestureRecognizer *doubleTap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired:2];
UIScrollView *s = [[UIScrollView alloc] initWithFrame:CGRectMake(768*i, 0, 768, 980)];
s.backgroundColor = [UIColor clearColor];
s.contentSize = CGSizeMake(768, 980);
s.delegate = self;
s.minimumZoomScale = 1.0;
s.maximumZoomScale = 3.0;
// s.tag = i+1;
[s setZoomScale:1.0];
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 980)];
NSString *imageName = [array objectAtIndex:i];
{
self.view.backgroundColor