objective c - download multiple images on iOS app -
i use code download images ios app web.
https://github.com/ashfurrow/afimagedownloader
[afimagedownloader imagedownloaderwithurlstring:@"http://static.ashfurrow.com.s3.amazonaws.com/github/worked.jpg" autostart:yes completion:^(uiimage *decompressedimage) { self.imageview.image = decompressedimage; }];
as can see code downloads 1 image...
how can download more images @ once?
let's images names that:
xy.png x number 1 999, , y number 1 4 example: 1651.png, 1652.png, 1653.png, 1654.png - can see, last digit of image names "y", 1 4... rule, image names ends 1, 2, 3, 4.
but, 165 "x", next set of images 1661.png, 1662.png, 1663.png, 1664.png
i hope got point.. so, need download images names 11.png 9994.png
any ideas? how download using above code , save them original name.
thanks in advance
ever heard of nested loop?
static const nsuinteger xlowerbound = 1; static const nsuinteger xupperbound = 999; static const nsuinteger ylowerbound = 1; static const nsuinteger yupperbound = 4; static nsstring *const path = @"http://static.ashfurrow.com.s3.amazonaws.com/"; static nsstring *const imgext = @"jpg"; (nsuinteger x = xlowerbound; x <= xupperbound; x++) { (nsuinteger y = ylowerbound; y <= ylowerbound; y++) { nsstring *combined = [nsstring stringwithformat:@"%lu%lu", (unsigned long)x, (unsigned long)y]; nsstring *urlstring = [path stringbyappendingpathcomponent:[combined stringbyappendingpathextension:imgext]]; [afimagedownloader imagedownloaderwithurlstring:urlstring autostart:yes completion:^(uiimage *decompressedimage) { // stuff } } }
that said, shouldn't doing this. =p
Comments
Post a Comment