MIT license FREE

The MIT license is an
open-source license.
Read full license

You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

(13 ratings)

Scroll Lazy Image Load for iOS

A UIScrollView component that lazy loads images as the user scrolls the view horizontally.

Share and win up to $15k in prizes each month!Learn more

Share

Description

A customizable UIScrollView for lazy loading multiple images. Useful for quickly loading views that contain images loaded from the web. Very simple to add to your application and style to your application look and feel.

Functionality

When the application loads, activity indicators are shown where images are being downloaded. Once the images are downloaded they will replace the loading indicators.

Clicking on an image will load that image on top of UIScrollView.

Back to top

Usage

Create a controller that implements ScrollLazyloadViewController.

In addition, the following classes must be implemented:

  1. Model class named ClsImgs
  2. UIView class named LazyloadView
  3. NSObject class named ImageDownloader

Implement ImageLazyLoadDelegate and create the properties included in ScrollLazyloadViewController.h :

@interface ScrollLazyloadViewController : UIViewController 

Modify objClsImgs.strURL in -(void)loadScrollImages to point to your images.

-(void)loadScrollImages function will add all objects of ClsImgs to Array and then It will set UIScrollView using -(void)setImageScrollView function.

In -(void)setImageScrollView, you can edit width and height of LazyLoadView using xPos += 68; and [scrollView setContentSize:CGSizeMake(xPos, 62)]; where 68 and 62 is width and height respectively.

For this you should have to change in your LazyLoadView.xib file accordingly in width or height.

ImageDownloader.h/m are used to download image using NSURLConnection. where we are passing objClsImgs.strURL for NSURLRequest in NSURLConnection.

- (void)loadImages checks for each image, if it is downloaded or pending.

If Images are not downloaded then It will call - (void)startIconDownload:(ClsImgs *)pClsImages forImgTag:(NSInteger)pImgTag.

After images are downloaded, - (void)appImageDidLoad:(NSInteger)pImgTag is called - use that for post load operations.

Read all 5 comments »

Questions & Comments

Leave a comment

You must be logged-in to leave a comment.
Log-in now or register for a free account.
  • anu said:

    9 months ago
    plz tell me how to add images in scrollview plz it's very urgent plz plz
    • Max Johnson Author said:

      9 months ago
      There is function like -(void)loadScrollImages in main Controller. This function will add number of images in one array.. and please see -(void)setImageScrollView, It will add images to ScrollView.
    • anu said:

      9 months ago
      Thanks it is woring but in scroll view images are not display in order
  • hiren said:

    11 months ago
    Great work and thanks a lot.
  • nikhil dhamsaniya said:

    1 year ago
    pretty handy thanks a lot...
You must be logged-in to vote. Log-in to your account or register now.
View all 9 reviews »

User Reviews