I 4枚の写真が含まれていると私は、Webからこれらの写真を取得するが、私はこれらの写真は ダウンロードした写真を保存するにはどうしたらいいですか?
再度ダウンロードされているのUITableViewを下にスクロールするときに問題があり、これはコードでのUITableViewCellあります
ITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellPhoto"];
if (cell == nil) {
NSArray *nibObject = [[NSBundle mainBundle] loadNibNamed:@"CustomCellThumbnails" owner:self options:nil];
cell = [nibObject objectAtIndex:0];
}
// Get the photos
int getPhotos = indexPath.row * 4;
for (int i = 1; i <= 4; i++) {
if (getPhotos < [imageArray count])
{
UIButton *imageButton = (UIButton*)[cell viewWithTag:i];
NSString *url = [imageArray objectAtIndex:getPhotos];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.siteweb.com%@",url]]];
UIImage *imageFieldProfile = [[UIImage alloc] initWithData:imageData];
dispatch_async(dispatch_get_main_queue(), ^{
// Set the phoyo to the UIButton
[imageButton setBackgroundImage:imageFieldProfile forState:UIControlStateNormal];
[imageFieldProfile release];
// Set the corner of UIButton
[imageButton.layer setCornerRadius:5.0];
[imageButton.layer setMasksToBounds:YES];
imageButton.tag = getPhotos;
});
});
[imageButton addTarget:self action:@selector(displayPhoto:) forControlEvents:UIControlEventTouchUpInside];
}
getPhotos ++;
}
を
しかし、私はnibファイルでカスタムUITableViewCellを持っていますが、どうすればinitWithStyleでUITableViewCellを作成できますか:reuseIdentifier:usingCacheTable: –
いいえ考えてみましょう - プロパティとして追加し、 '[cell setMyCache:]'を代わりに使うことを検討してください。 –