Create a controller that implements
In addition, the following classes must be implemented:
- Model class named ClsImgs
- UIView class named LazyloadView
- NSObject class named ImageDownloader
Implement ImageLazyLoadDelegate and create the properties included in
@interface ScrollLazyloadViewController : UIViewController
-(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, 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
- (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.