Saturday, March 2, 2013

ScrollView


- (void)viewDidLoad {

    [super viewDidLoad];
    UIImage *image = [UIImage imageNamed:@"ae.jpg"];
    imageView = [[UIImageView alloc]initWithImage:image];
    imageView.frame = [[UIScreen mainScreen] bounds];
    imageView.contentMode = (UIViewContentModeScaleAspectFit);
    imageView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    imageView.backgroundColor = [UIColor clearColor];



    UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    scrollView.contentMode = (UIViewContentModeScaleAspectFit);

    scrollView.contentSize = CGSizeMake(image.size.width,960);
    scrollView.pagingEnabled = NO;
    scrollView.showsVerticalScrollIndicator = NO;
    scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.alwaysBounceVertical = NO;
    scrollView.alwaysBounceHorizontal = NO;
    scrollView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    scrollView.maximumZoomScale = 2.5;
    scrollView.minimumZoomScale = 1;
    scrollView.clipsToBounds = YES;
   [scrollView addSubview:imageView];
   [image release];
    [imageView release];
   [self.view addSubview:scrollView];
}

http://stackoverflow.com/questions/6876089/add-10-different-uiimages-in-uiscrollview

No comments:

Post a Comment