2

UITableView で DetailTextLabel の色を変更できないようです。

フォントとサイズは変更できますが、色は変更できません。これが私のコードです:

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.

} 

DetailTextLabel は常に灰色で表示されます。これを変更するにはどうすればよいですか?

4

3 に答える 3

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

これを試してください私はこれがうまくいくと思います

于 2012-12-24T06:33:43.293 に答える
1

セルの背景色の設定を含め、デフォルトの UITableViewCells の色を変更するには、以下のデリゲート メソッドを追加します。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
于 2013-03-25T08:21:20.727 に答える