2011-01-07 94 views
0

我有一個寬度爲320px的背景圖像的自定義單元格(設置在IB中)。單元格的寬度也是320.當我運行我的應用程序時,單元格右側有大約5像素的白色。換句話說,我的圖像並不包含整個屏幕的寬度。我的代碼如下所示:自定義表格視圖單元格w /背景圖像 - 寬度問題

- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath { 
     static NSString *OffensivePlayerCellIdentifier = @"OffensivePlayerCellIdentifier"; 
    OffensivePlayerCell *cell = (OffensivePlayerCell *)[tableView dequeueReusableCellWithIdentifier: OffensivePlayerCellIdentifier]; 
    if(cell == nil) { 
     NSArray *nib = [[NSBundle mainBundle] loadNibNamed: @"OffensivePlayer" owner: self options: nil]; 
     cell = [nib objectAtIndex: 0]; 
    } 
    return cell; 
} 

任何想法?

回答

0

好吧,不是直接將圖像應用於單元格的背景,而是嘗試添加圖像視圖並將圖像應用於該圖像。現在它可以工作。不知道爲什麼。奇怪的行爲。

相關問題