I want to create array of image instead of one image in below code
- (void)viewDidLoad 
    {
        UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
        scrollView.contentSize = CGSizeMake(550, 800);
        NSString *imageName = [NSString stringWithFormat:@"page-1.jpg" ];
        UIImage *image = [UIImage imageNamed:imageName];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        [scrollView addSubview:imageView];
        imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        [imageView release];
        scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresi开发者_C百科zingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        [self.view addSubview:scrollView];
        [scrollView release];
        [super viewDidLoad];
    }
how i create it? and deploy another functionality of scroll view.
I changed your code a bit to add 10 images, instead of 1. Is this what you want?
- (void)viewDidLoad 
{
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
    int numberOfImages = 10;
    CGFloat currentX = 0.0f;
    for (int i=1; i <= numberOfImages; i++) {
        // create image
        NSString *imageName = [NSString stringWithFormat:@"page-%d.jpg", i];
        UIImage *image = [UIImage imageNamed:imageName];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        // put image on correct position
        CGRect rect = imageView.frame;
        rect.origin.x = currentX;
        imageView.frame = rect;
        // update currentX
        currentX += imageView.frame.size.width;
        [scrollView addSubview:imageView];
        [imageView release];
    }
    scrollView.contentSize = CGSizeMake(currentX, 800);
    scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
    [self.view addSubview:scrollView];
    [scrollView release];
    [super viewDidLoad];
}
Hope it helps!
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论