UiscrollView 简单使用
示例代码如下:
UIScrollView *scrView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width , self.view.frame.size.height)];
scrView.scrollEnabled = YES;
scrView.contentSize = CGSizeMake(self.view.frame.size.width*3,self.view.frame.size.height);
scrView.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:scrView];
UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, scrView.frame.size.height)];
[scrView addSubview:imgView];
UIImageView *imgView2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width, 0, scrView.frame.size.width, scrView.frame.size.height)];
[scrView addSubview:imgView2];
UIImageView *imgView3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width*2, 0, scrView.frame.size.width, scrView.frame.size.height)];
[scrView addSubview:imgView3];
imgView.image = [UIImage imageNamed:@"1"];
imgView2.image = [UIImage imageNamed:@"2"];
imgView3.image = [UIImage imageNamed:@"3"];