gpt4 book ai didi

ios - UITableView 文本覆盖我的自定义部分标题?

转载 作者:行者123 更新时间:2023-11-29 10:44:54 26 4
gpt4 key购买 nike

我的问题是,当我在 UITableView 中滚动时,行文本结束在我的部分标题文本的正上方。当下一个部分标题出现时,它会强制滚动前一个部分(这是预期的)。

这是我的代码 public override UIView GetViewForHeader (UITableView tableView, int section) { var myHeader = new UIView (); myHeader.Frame = new RectangleF (10, 0, 320, 30);

        var lbl = new UILabel ();
lbl.Frame = new RectangleF(10, 8, 320, 20);
lbl.Text = TitleForHeader (tableView, section);
lbl.Font = UIFont.BoldSystemFontOfSize (18f);
lbl.Center = myHeader.Center;

myHeader.AddSubview(lbl);
return myHeader;
}

public override float GetHeightForHeader (UITableView tableView, int section)
{
return GetViewForHeader (tableView, section).Frame.Height;
}

我错过了什么?

最佳答案

办公 table 时刻。

View 的默认行为是具有透明背景。设置 myHeader.BackgroundColor = tableview.BackgroundColor 后,它按预期工作。

关于ios - UITableView 文本覆盖我的自定义部分标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22719905/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com