How to use EGOImageLoading with ASIHTTPRequest ? where is the viewDidLoad in EGOImageLoading?
-
10-03-2021 - |
Question
I want use the EGOImageLoading to load pictures to a UITableVIew. I got the URLs by ASIHTTPRequest in the viewDidLoad function and put them in an Array.
I've read the demo of EGOImageLoading , but cannot find the viewDidLoad function? Could some one tell me if i need a viewDidLoad function? or just write in the awakeFromNib function?
No correct solution
OTHER TIPS
You have to take custom cell and set EGOImageView
there see following Code.
-(void)drawImageView {
memberImg =[[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"thumbnail.png"]];
memberImg.frame = CGRectMake(5.0f, 7.0f,52.0f,63.0f);
memberImg.layer.masksToBounds = YES;
memberImg.layer.cornerRadius = 7.0;
[self.contentView addSubview:memberImg];
}
-(void)setMemberPhoto:(NSString *)photo
{
memberImg.imageURL = [NSURL URLWithString:photo];
}
add above code in custom cell class .m file and add following code in celForRowAtIndexPath
method.
static NSString *temp= @"AlbumCustomCell";
AlbumCustomCell *cellheader = (AlbumCustomCell *)[albumTableObj dequeueReusableCellWithIdentifier:temp];
if (cellheader == nil) {
NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"AlbumCustomCell" owner:self options:nil];
cellheader = [nib objectAtIndex:0];
cellheader.showsReorderControl = NO;
cellheader.selectionStyle = UITableViewCellSelectionStyleNone;
cellheader.backgroundColor=[UIColor clearColor];
[cellheader drawImageView];
}
[cellheader setMemberPhoto:photos];
return cellheader;
}
EGOImageLoading
is used for loading images asynchronously and does not require any other outside networking libraries to function. All you do is set the imageURL
, and the download is handled automatically. You do not need to use ASIHTTPRequest
to load images if you are using EGOImageLoading
.
In addition to that, viewDidLoad
is a UIViewController
function that does not have anything to do with either of these things.