2012-02-16 114 views
3

我的一個應用程序具有圖片作爲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

回答

-1

使用唯一的名字不延伸

的UIImage * CHANGE1 = [UIImage的imageNamed:@ 「playalbum-06」];