2012-01-06 30 views
0

創建動態URL我用這API創建我的應用程序的在線圖片庫,但問題是我需要創建一個動態庫,從示例代碼的代碼顯示來自Flickr只是一些圖片,我需要演出從這裏URL圖像是代碼:iOS裝置:用於KTPhotoBrowserDataSource

例如:www.mysite.com/gallery

並在此URL有很多照片!

- (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"]]; 
} 
+0

看起來像你失去了你的問題到底有沒有。此外,這應該是在這裏,而不是在這裏。投票結束它,但如果你完成這個問題,也許一個很好的mod將會改變你的問題。 – DKnight 2012-01-06 13:33:04

+0

對不起「但是」是我的錯誤,我刪除了 – 2012-01-06 13:36:17

回答