Hey all, I've got a UITableViewCell that I want to change the
HighlightedTextColor. Setting the HighlightedtextColor property only seems to
work when UITableViewCellSelectonStyle is set to something other than None. Do
I have to subclass UITableViewCell to get this to apply or am I just missing
something?
Here's a trimmed down version of my GetCell method. Note: Setting
SelectionStyle to anything but none makes the highlighted color show as
expected when the row is selected
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath
indexPath)
{
// the row index
int row = indexPath.Row;
var dRow = Rows [row];
// get a reusable cell instance
and set the style
var cell =
tableView.DequeueReusableCell (TableCellIdentifier + dRow.ViewName +
dRow.Text); if
(cell == null) {
cell =
InstantiateCell(dRow, UITableViewCellStyle.Subtitle, TableCellIdentifier);
if(indexPath.Row % 2 == 0){
// setting this to anything but None shows the highlighted text color
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
var label = cell.TextLabel;
label.TextColor = UIColor.Black;
label.HighlightedTextColor = UIColor.Yellow;
}else{
// setting this to anything but None shows the highlighted text color
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
var label = cell.TextLabel;
label.TextColor = UIColor.Black;
label.HighlightedTextColor = UIColor.Yellow;
}
}
Thanks in advance for any insight.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch