Simple album implementation
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. self. view. backgroundColor = [UIColor whiteColor]; UIScrollView * scrollView = [[UIScrollView alloc] initWithFrame: CGRectMake (0, 0,320, [UIScreen mainScreen]. bounds. size. height)]; scrollView. tag = 100; scrollView. contentSize = CGSizeMake (320*6, [UIScreen mainScreen]. bounds. size. height); scrollView. delegate = self; scrollView. pagingEnabled = YES; scrollView. showsHorizontalScrollIndicator = NO; [self. view addSubview: scrollView]; [scrollView release]; for (int I = 0; I <6; I ++) {UIScrollView * scroll = [[UIScrollView alloc] initWithFrame: CGRectMake (I * 320, 0,320,568)]; scroll. maximumZoomScale = 4.0; scroll. minimumZoomScale = 1; scroll. delegate = self; scroll. tag = 110 + I; [scrollView addSubview: scroll]; [scroll release]; UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (0, 0,320,568)]; imageView. image = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: [NSString stringWithFormat: @ "% d", I + 1] ofType: @ "jpg"]; imageView. tag = 101 + I; [scroll addSubview: imageView]; [imageView release];} UIPageControl * pageControl = [[UIPageControl alloc] initWithFrame: CGRectMake (10,528,300, 20)]; pageControl. tag= 120; pageControl. numberOfPages = 6; pageControl. pageIndicatorTintColor = [UIColor grayColor]; pageControl. currentPageIndicatorTintColor = [UIColor greenColor]; pageControl. currentPage = 0; [pageControl addTarget: self action: @ selector (handlePageControl :) forControlEvents: UIControlEventValueChanged]; [self. view addSubview: pageControl]; [pageControl release];} // set the zoom-(UIView *) viewForZoomingInScrollView :( UIScrollView *) scrollView {switch (scrollView. tag) {case 110: return [scrollView viewWithTag: 101]; case 111: return [scrollView viewWithTag: 102]; case 112: return [scrollView viewWithTag: 103]; case 113: return [scrollView viewWithTag: 104]; case 114: return [scrollView viewWithTag: 105]; case 115: return [scrollView viewWithTag: 106]; default: break;} return nil ;} // slide pageControl-(void) handlePageControl :( UIPageControl *) pageControl {UIScrollView * scrollView = (UIScrollView *) [self. view viewWithTag: 100]; [scrollView setContentOffset: CGPointMake (320 * pageControl. currentPage, 0) animated: YES];} // restore the source image size-(void) scrollViewDidEndDecelerating :( UIScrollView *) scrollView {switch (scrollView. tag) {case 100: {UIPageControl * pageControl = (UIPageControl *) [self. view viewWithTag: 120]; pageControl. currentPage = scrollView. contentOffset. x/320; for (UIScrollView * scroll in scrollView. subviews) {if ([scroll isKindOfClass: [UIScrollView class]) {[scroll setZoomScale: 1.0] ;}} break; default: break ;}}