【发布时间】:2012-01-06 13:23:48
【问题描述】:
我正在使用这个API 为我的应用程序创建一个在线图片库,但问题是我需要创建一个动态画廊这个示例代码中的代码仅显示来自 flickr 的一些图像,我需要显示来自 URL 的图像这里是代码:
例如:www.mysite.com/gallery
而且这个网址上有很多照片!
- (id)init {
self = [super init];
if (self) {
// Create a 2-dimensional array. First element of
// the sub-array is the full size image URL and
// the second element is the thumbnail URL.
images_ = [[NSArray alloc] initWithObjects:
[NSArray arrayWithObjects:@"http://farm5.static.flickr.com/4001/4439826859_19ba9a6cfa_o.jpg", @"http://farm5.static.flickr.com/4001/4439826859_4215c01a16_s.jpg", nil],
[NSArray arrayWithObjects:@"http://farm4.static.flickr.com/3427/3192205971_0f494a3da2_o.jpg", @"http://http://farm4.static.flickr.com/3427/3192205971_0f494a3da2_o.jpg" , nil];
}
return self;
}
#pragma mark -
#pragma mark KTPhotoBrowserDataSource
- (NSInteger)numberOfPhotos {
NSInteger count = [images_ count];
return count;
}
- (void)imageAtIndex:(NSInteger)index photoView:(KTPhotoView *)photoView {
NSArray *imageUrls = [images_ objectAtIndex:index];
NSString *url = [imageUrls objectAtIndex:FULL_SIZE_INDEX];
[photoView setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"photoDefault.png"]];
}
- (void)thumbImageAtIndex:(NSInteger)index thumbView:(KTThumbView *)thumbView {
NSArray *imageUrls = [images_ objectAtIndex:index];
NSString *url = [imageUrls objectAtIndex:THUMBNAIL_INDEX];
[thumbView setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"photoDefault.png"]];
}
【问题讨论】:
-
看起来您在此处丢失了问题的结尾。此外,这应该在 SO 而不是这里。投票结束它,但如果你完成了这个问题,也许一个不错的 mod 会为你转移问题。
-
对不起“但是”是我的错误,我删除了