How to load bundle of images in a scrollview with horrizondal scrolling in iphone?

I have an iPhone application in which i need to load a bulk of images (ie around 50),which has a small rect like (little above thumbnail) containing 3 in each row with 4 columns in one page, and i need to scroll horizontally to load the next 12 images and so on. Also i need to show the page number under it as 1,2 the attached image

Can any body guide me in the right direction to achieve this in a scroll view ?i am really in a mess ,how to add imageview to a scrollview like this ,also each image view has its own buttons also.

  • Swift - determine which button was pressed with switch
  • blob does not accept Uint8Array on ios
  • Why is this code not recognising the NSString as being equal?
  • sqlite database update when app version changes on Appstore in iPhone
  • Credential match from Plist
  • Animate changes during device rotation based on size element will be after rotation completes
  • 2 Solutions Collect From Internet About “How to load bundle of images in a scrollview with horrizondal scrolling in iphone?”

    The way i would tackle this problem goes as follows: (I am not going to provide many details as they are dependent on your particular needs and requirements).

    .h file:

    #import <UIKit/UIKit.h>
    @interface ViewController : UIViewController <UIScrollViewDelegate>
    @property (unsafe_unretained, nonatomic) IBOutlet UIScrollView *scrollView;//assuming the scrollView is connected in a xib file
    -(id)initWithImages:(NSArray*)images;//that could be whatever format you get your images(UIImage, urls to download, file names or custom views. Here we assume that the array contains instances of UIImage)

    .m file:

    #import "ViewController.h"
    @interface ViewController ()
    @property (nonatomic, strong) NSArray *images;
    @property (nonatomic, assign) CGFloat pageWidth;
    @property (nonatomic, assign) int currentPage;
    @implementation ViewController
        self = [super init];
            self.images = images;
        return self;
        [super viewDidLoad];
        [self.scrollView setDelegate:self];
        [self.scrollView setContentSize:CGSizeMake(self.scrollView.frame.size.width*self.imageURLsArray.count,
        [self.scrollView setPagingEnabled:YES];
        [self.scrollView setShowsVerticalScrollIndicator:NO];
        self.pageWidth = self.scrollView.frame.size.width;
        for(int i = 0; i < self.images.count; i++){
            UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.scrollView.frame.size.width*i,
            imageView.image = [self.images objectAtIndex:i];
            [self.scrollView addSubview:imageView];
    -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
        int page = floor(scrollView.contentOffset.x - self.pageWidth/2)/self.pageWidth + 1;
        if(self.currentPage != page){
            NSLog(@"Scrolled to new page: %d", page);
            self.currentPage = page;
    //do additional things based on the fact that you have scrolled to a new page (like changing the page number)

    Use UItableview create custom cell with two imageviews on it and load that custom cell to cell for indexpath then create an nsarray and pass the image names into that array and then convert that image into data format for eg

    nsdata *data = [NSdata dataWithcontents of url [array object at index:indexpath.row]];
    cell.imageview.image = [uiimage imagewithdata:data];
    for this you should know to create custom cells.