图像的UITableView细胞

问题描述:

我的一个应用程序具有图片作为UITableView的细胞背景下的财产,同时测试,每一件事情是好的,是完全一样的代码测试的图像和细胞身高,但是当它被上传,我试图通过iPhone,iPad上下载了好几次,细胞被拉长和所采取的措施,同时测试完全是不同的,图像不清晰,在所有的应用程序都包含有2种尺寸的图像(另一个是视网膜大小@ 2X)我不知道什么这个问题还是什么我丢失,现在用的XCode 4.2, 请咨询,图像的UITableView细胞

感谢您的迅速回复, 好,其应用程序内购买包含了许多专辑,这些专辑都位于每个人在uitable观察室一个图像,当下载时,图像将改变和UITableView的自动刷新,首先该图像被在阵列中(viewDidLoad中)设置

'

UIImage *awwal = [UIImage imageNamed:@"album-01.png"]; 
    UIImage *teni = [UIImage imageNamed:@"album-02.png"]; 
    UIImage *telet = [UIImage imageNamed:@"album-03.png"]; 
    UIImage *rabee = [UIImage imageNamed:@"album-04.png"]; 
    UIImage *akhir = [UIImage imageNamed:@"album-05.png"]; 
    UIImage *ba3do = [UIImage imageNamed:@"album-zaman.png"]; 
    UIImage *aatiha = [UIImage imageNamed:@"album-tarab.png"]; 
    UIImage *j3ala = [UIImage imageNamed:@"album-monawaa.png"]; 

    NSMutableArray *images = [[NSMutableArray alloc] initWithObjects: awwal, teni, telet, rabee, akhir, ba3do, aatiha, j3ala, nil]; 
self.AlbumsImages = images; 
    [images release];' 
其中的tableView加载

并且那

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"CellIdentifier"; 
    // NSLog(@"%@",AlbumsImages); 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 

     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    } 
    NSUInteger row = [indexPath row]; 
    NSArray *myPathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 
    NSString *myPath = [myPathList objectAtIndex:0]; 
    NSString* storagePath = [myPath stringByAppendingPathComponent:@"purchasedAlbums.plist"]; 
    NSArray* valueList = [[NSArray alloc] initWithContentsOfFile:storagePath]; 

    UIImage *change1 = [UIImage imageNamed:@"playalbum-06.png"]; 
    UIImage *change2 = [UIImage imageNamed:@"playalbum-07.png"]; 
    UIImage *change3 = [UIImage imageNamed:@"playalbum-08.png"]; 
    UIImage *change4 = [UIImage imageNamed:@"playalbum-09.png"]; 
    UIImage *change5 = [UIImage imageNamed:@"playalbum-11.png"]; 
    UIImage *change6 = [UIImage imageNamed:@"playalbum-12.png"]; 
    UIImage *change7 = [UIImage imageNamed:@"playalbum-10.png"]; 
    UIImage *change8 = [UIImage imageNamed:@"playalbum-13.png"]; 

    int i; 
    for (i = 0; i <= [AlbumsImages count]; i++) { 


    if ([[valueList objectAtIndex:i+1] intValue]) { 
     if (i == 0) { 
      [AlbumsImages replaceObjectAtIndex:0 withObject:change1]; 
     } 
     if (i == 1) { 
      [AlbumsImages replaceObjectAtIndex:1 withObject:change2]; 
     } 
     if (i == 2) { 
      [AlbumsImages replaceObjectAtIndex:2 withObject:change3]; 
     } 
     if (i == 3) { 
      [AlbumsImages replaceObjectAtIndex:3 withObject:change4]; 
     } 
     if (i == 4) { 
      [AlbumsImages replaceObjectAtIndex:4 withObject:change5]; 
     } 
     if (i == 5) { 
      [AlbumsImages replaceObjectAtIndex:5 withObject:change6]; 
     } 
     if (i == 6) { 
      [AlbumsImages replaceObjectAtIndex:6 withObject:change7]; 
     } 
     if (i == 7) { 
      [AlbumsImages replaceObjectAtIndex:7 withObject:change8]; 
     } 

    } 
} 
     //cell.textLabel.text = [AlbumsView objectAtIndex:row]; 
    cell.imageView.image = [AlbumsImages objectAtIndex:row]; 
    cell.tag=row+1; 
    return cell; 
} 

其中更改1,2,3 .....是在下载相册时替换的图像。

+0

给你的代码..在这里你设置的图像。 – Shubhank 2012-02-16 16:47:43

+0

什么意思是什么时候上传并尝试下载多次?还请提供一些代码,以便我们看到可能导致问题的原因。 – Mark 2012-02-16 16:51:06

+0

逗人感到非常心存感激, 问题是与代码修改,如果可能的话务检查和咨询, – 2012-02-16 17:14:32

使用唯一的名字不延伸

的UIImage * CHANGE1 = [UIImage的imageNamed:@ “playalbum-06”];