2012-07-25 74 views
0

enter image description here的backgroundColor爲TableViewCell不工作

就像你在圖片中看到,我有一個的tableView(視圖tableviewController的),藍色的觀點是爲第一個headerView,當我點擊它,它崩潰了一些細胞,但我的問題是,單元格的背景的第一部分tableView(雲)作爲背景[在這張圖片中我設置單元格的背景顏色清除,但如果我給它設置一個顏色左右(LR中的圖片)部分仍然存在]

我嘗試:cell.layer.masksToBounds = YES;和cell.contentView.layer.masksToBounds = YES;

我該如何解決這個問題?以及爲什麼該單元格將tableView BackGroundColor [image]的第一部分作爲BackGroundColor?

編輯:一些代碼(我覆蓋在這樣的背景故事板的所有值...)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
    static NSString *CellIdentifier = @"clientCell"; 
    ClientCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if ([[[[[[DataManager sharedManager] clientsList] objectAtIndex:indexPath.section] objectForKey:@"rewards"] objectAtIndex:indexPath.row] valueForKey:@"description"] != [NSNull null]) 
    { 
    cell.voucherDescription.text = [[[[[[DataManager sharedManager] clientsList] objectAtIndex:indexPath.section] objectForKey:@"rewards"] objectAtIndex:indexPath.row] valueForKey:@"description"]; 
    } 

//configure more labels .. 

[cell setBackgroundColor:[UIColor clearColor]]; 
[cell.voucherDescription setFont:[UIFont fontWithName:SharkFontSystemeName size:17]];  
return cell; 
} 
在viewDidLoad中

[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]]]; 
+1

嘗試將圖像視圖添加到單元格作爲addsubview,並且可以根據您的要求爲圖像視圖設置框架。 – Mrunal 2012-07-25 11:18:18

+0

這不起作用,我認爲這個問題不是'只是'在單元格中,因爲如果我使用顏色代替「colorWithPatternImage:」似乎工作正常。 – 2012-07-25 12:09:52

+0

請添加您的代碼以更好地瞭解您的問題。 – Mrunal 2012-07-25 14:42:07

回答

0

問題的決心,我從UITableViewController中改變的viewController到一個UIViewController並添加一個tableView作爲一個子視圖,並且不會改變任何完美工作的代碼中的任何Thing。 這是一個錯誤還是我錯過了什麼?