[英]Change to custom background when a cell is highlighted
選擇自定義單元格后,如何更改其背景?
謝謝,尼爾斯
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
UIView *v = [[[UIView alloc] init] autorelease];
v.backgroundColor = [UIColor blueColor];
cell.selectedBackgroundView = v;
用這個
您需要UITableViewCell
,並重寫以下方法:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated;
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
您可以在那里更改單元格的背景圖像。
單元格的selectionStyle
屬性也允許一些非常基本的自定義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.