2011-10-12 57 views
-1

即時解析一個JSON訂閱源使用異步圖像下載我下載圖像(大約18個圖像)並將其存儲在UIImage.how中以獲取圖像的數量,以便我可以迭代在loop.below是代碼如何獲取圖像數組的數量

- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image 
{ UIImage *boom=image; 
//download the image and storing it in UIImage 

} 
+0

兩降兩個days..hate downvote..seriously笏ž烏爾問題的人票(不管是誰,可能是)......我在這裏臨時抱佛腳我的頭爲更好的答案和所有你ç做的是jst給一個downvote..bravo人 – kingston

+0

我不認爲這是一個「仇恨downvote」 - 你的問題不清楚,所以它已被低估。你提到一個數組,但你的代碼沒有數組。事實上,你的代碼實際上並沒有做任何事情。 – jrturton

+0

如果dats案件jst告訴我的理由爲什麼我給了一個票..我至少改變我的回答,以獲得更好的結果...對不起,因爲粗魯我有點沮喪..... – kingston

回答

1

在您委託的回調,你應該添加處理元素的NSMutableArray。事情是這樣的:

// MainViewController.h 
... 
{ 
    NSMutableArray *synced; 
} 

@property (nonatomic, retain) NSMutableArray *synced; 

和:

// MainViewController.m 

@synthesize synced; 

... 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.synced = [NSMutableArray array]; 
} 


- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image 
{ 
    [self.synced addObject:image]; 
    self.syncedLabel.text = [NSString stringWithFormat:@"%i images", [self.synced count]]; 
} 
+0

感謝之人..dat工作 – kingston

相關問題