2013-11-02 55 views
1

我有一個自定義的排行榜,我將Game Center個人資料圖片加載到32位高的UITableCell中。UITableViewCell imageView問題

當我將圖像設置爲200x32左右時,會發生什麼情況,然後快速調整爲正方形。在顯示正確之前,用戶會看到圖像扭曲的地方。

這裏發生了什麼?我怎樣才能解決這個問題?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if ([GCCustomLeaderboard sharedInstance]->nearbyScores.count == 0){ 
     return nil; 
    } 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyBasicCell"]; 
    GCLeaderboardScore *playerScore = [[GCCustomLeaderboard sharedInstance]->nearbyScores objectAtIndex:indexPath.row]; 
    cell.textLabel.text = [NSString stringWithFormat:@"%@: (%d)", playerScore->alias, (int)playerScore->score]; 
    cell.imageView.image = playerScore->photo; 

    return cell; 
} 
+2

備註:cellForRowAtIndexPath不能返回nil。我認爲,如果iOS發生異常,則會引發異常。 –

+0

我沒有注意到任何問題,但謝謝,我想它從來沒有真正發生,因爲我指定了正確的行數(希望)! – Chris

回答

0

要解決這個問題,我不得不調整我的圖像之前,把它們放在表中。