• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

c# - 弄清楚如何摆脱 UITableView 单元格中单元格周围的边框

[复制链接]
菜鸟教程小白 发表于 2022-12-12 10:00:37 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我最近通过使用 monotouch.dialog 覆盖 GetCell 方法来获取单元格上可用的属性。我现在的问题是我看不到摆脱单元格周围的默认边框。

我能够弄清楚如何在单元格周围绘制自己的边框(我相信它为此使用了核心图形和单元格上的 .Layer 属性)。但是,旧边框仍然存在,我找不到禁用此功能的属性。

理想情况下,我希望自己能够自定义现有边框,但如果这不可能(无需制作我自己的单元格图形),那么我想删除默认边框并使用生成的边框代码。

请参阅下面的覆盖方法和我到目前为止的屏幕截图:

public override UITableViewCell GetCell(UITableView tableView) {
    var cell = base.GetCell(tableView);
    cell.BackgroundColor = Resources.XDarkGrayColor;
    cell.TextLabel.TextColor = Resources.XWhiteColor;
    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
    cell.Layer.ShadowColor = UIColor.Red.CGColor;
    cell.Layer.BorderColor = UIColor.Red.CGColor;
    cell.Layer.BorderWidth = 2.0f;
    cell.Layer.CornerRadius = 5.0f;
    cell.Layer.ShadowRadius = 2.0f;
    cell.Layer.ShadowOpacity = 0.75f;

    return cell;
}

This shows the red border I created in code using the .Layer property of a cell, and then the default border around the cell just on the inside of the red border



Best Answer-推荐答案


IIRC(现在不能尝试)这是使用背景 View 绘制的。因此,您需要删除它,例如:

cell.BackgroundView = new UIView (RectangleF.Empty);

或将 Bounds 属性设置为 Empty,如:

cell.BackgroundView.Bounds = RectangleF.Empty;

关于c# - 弄清楚如何摆脱 UITableView 单元格中单元格周围的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15724401/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap