UITableViewCell的選中時的顏色設定

2021-06-06 05:16:03 字數 1224 閱讀 8580

//無色

cell.selectionstyle = uitableviewcellselectionstylenone;

//藍色

cell.selectionstyle = uitableviewcellselectionstyleblue;

//灰色

cell.selectionstyle = uitableviewcellselectionstylegray;

改變uitableviewcell選中時背景色:

uicolor

*color = [[

uicolor

alloc]initwithred:

0.0green:

0.0blue:

0.0alpha:

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

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

cell.selectedbackgroundview.backgroundcolor = [uicolor ******];

3自定義uitableviewcell選中時背景

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

...}

計算UITableViewCell高度

uitableview是先執行 cgfloat tableview uitableview tableview heightforrowatindexpath nsindexpath indexpath函式計算整個uitableview內容高度,然後才執行 uitableviewcell table...

UITableViewCell重用問題

在寫sina 微博介面的過程中使用到了cell,那麼就是在cell上新增一些控制項,但是由於每條微博的內容都是不同的,所以在顯示的過程中,出現了內容重疊的問題,其實就是uitableviewcell重用機制的問題。cpp view plain copy uitableviewcell tablevi...

UITableViewCell重用機制

uitableview是ios開發中使用頻率非常高的乙個控制項,它常被用來展示資訊列表,儘管資訊資料可能非常多,但uitableview消耗的資源卻並不會隨著展示資訊的增多而變大,這都要得益於uitableviewcell的重用機制,重用機制 顧名思義,就是反覆利用資源的機制。以下通過一些 來看下通...