tableviewcell的一些基本知識點

2021-06-27 04:51:21 字數 1360 閱讀 8823

[cpp]view plain

copy

//無色

cell.selectionstyle = uitableviewcellselectionstylenone;  

//藍色

cell.selectionstyle = uitableviewcellselectionstyleblue;  

//灰色

cell.selectionstyle = uitableviewcellselectionstylegray;  

改變uitableviewcell選中時背景色:

uicolor

*color = [[

uicolor

alloc]initwithred:

0.0green:

0.0blue:

0.0alpha:

1];//通過rgb來定義自己的顏色

[html]view plain

copy

cell.selectedbackgroundview

= [[[uiview alloc] initwithframe:cell.frame] autorelease];  

cell.selectedbackgroundview.backgroundcolor

= [uicolor ******];  

3自定義uitableviewcell選中時背景

[html]view plain

copy

cell.selectedbackgroundview

= [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"cellart.png"]] autorelease];   

還有字型顏色   

cell.textlabel.highlightedtextcolor

= [uicolor ***color];  [cell.textlabel settextcolor:color];//設定cell的字型的顏色  

[thetableview setseparatorcolor:[uicolor ***x ]];

5、設定cell中字型的顏色-(

uitableviewcell

*)tableview

:(uitableview

*)tableview cellforrowatindexpath

:(nsindexpath

*)indexpath

...}

自定義tableviewcell(一)

建立乙個新類繼承tableviewcell,覆寫下列函式,用 建立控制項 id initwithstyle uitableviewcellstyle style reuseidentifier nsstring reuseidentifier return self 重寫一下setter void ...

關於TableView Cell的一些設定

tableview 的 separatorstyle 設定是否有線 風格 一 設定cell底部線 的位置 自定義cell內 self.separatorinset uiedgeinsetszero if self respondstoselector selector setlayoutmargin...

乙個有關tableViewCell的復用問題

背景 tableview有兩個分組,兩個分組中的cell裡面控制項布局不同.手寫 布局cell.問題 手寫 的cell復用,上面新增的控制項沒有移除,會出現重疊.而且最開始用了乙個復用id,也就是預設了整個tableview是一類的cell.所以在頁面中,尤其是復用了cell的時候,兩種cell 會...