Search code examples
uitableviewxamarin.iosdetailtextlabel

How do I change the colour of the DetailTextLabel using Monotouch?


I seem to be unable to change the colour of the DetailTextLabel in a UITableView.

I can change the font and size but not the colour. Here is my code:

public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{

  UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Value1, cellIdentifier); 

  cell.TextLabel.Text = Label;
  cell.TextLabel.AdjustsFontSizeToFitWidth = true;
  cell.UserInteractionEnabled = false;

  cell.DetailTextLabel.Font = UIFont.SystemFontOfSize (13f);
  cell.DetailTextLabel.Text = Data;
  cell.DetailTextLabel.AdjustsFontSizeToFitWidth = true;
  cell.DetailTextLabel.TextColor = new UIColor(0,0,0,0);  // THIS BIT NEVER WORKS
  // cell.DetailTextLabel.TextColor = UIColor.Black;  // NEITHER DID THIS.

} 

The DetailTextLabel always appears in grey no matter what. How do i change this?


Solution

  •  cell.DetailTextLabel.textColor = [UIColor colorWithRed:0 green:0 blue:0.6 alpha:1]
    

    try this i suppose this work