2011-10-03 28 views
1

對於 UITableView一個小的額外線繪製的實現代碼如下如何解決邊境的UITableView爲UITableViewStyleGrouped

我該如何解決這個問題下面?

我已經盡力了。到目前爲止沒有運氣。

提前致謝。

我的代碼

-(void)myTableView 
{ 
// if(mytableView != nil) 
// [mytableView release]; 

    if (mytableView == nil) { 

     mytableView = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped]; 

    } 
    mytableView.delegate=self; 
    mytableView.dataSource=self; 
    mytableView.backgroundView=nil; 
    mytableView.scrollEnabled = FALSE; 
    [self.view addSubview:mytableView]; 
    [self myPortraitMode]; 
} 

表中的背景是固定的是一個圖像。

+1

你必須清楚地解釋你的自我?你的問題到底是什麼? – shannoga

+0

@ user891268,這是分組表格視圖的默認樣式。你爲什麼想改變它? – EmptyStack

+0

它看起來不好,如果你不設置背景視圖 – hypercrypt

回答

1

您需要設置背景圖:

UIView *backgroundView = [[UIView alloc] init]; 
backgroundView.backgroundColor = [UIColor yourColor]; 
tableview.backgroundView = backgroundView; 
[backgroundView release]; 

您不必每次都設置屬性。

-(void)myTableView 
{ 
    if (mytableView == nil) { 
     mytableView = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped]; 
     mytableView.delegate=self; 
     mytableView.dataSource=self; 
     mytableView.backgroundView=nil; 
     mytableView.scrollEnabled = NO; 
     [self.view addSubview:mytableView]; 
     [self myPortraitMode]; 
    } 
} 

我真的不明白是什麼問題。

+0

它仍然繪製顏色..........行到tableviewCell的底部 – user891268

+0

你有一個更全面的問題和你的代碼正在設置表視圖? – hypercrypt

+0

爲backgroundView其圖像。在UITableview – user891268

2

我認爲你所指的是表視圖的斜角顏色。 答案在於post。 基本上,您需要將表separatorStyle設置爲UITableViewCellSeparatorStyleNoneUITableViewCellSeparatorStyleSingleLine

+0

這是正確的答案,選擇的是用於更改整個背景,而不是根據要求刪除多餘的線。 – Beppe

相關問題