首页 文章

删除xib中的表视图单元格的分隔符行[复制]

提问于
浏览
0

这个问题在这里已有答案:

我已经创建了一个带有xib文件的自定义UITableViewCell类 .

在单元格xib中,我将表格视图单元格的分隔符设置为"Custom Insets",其中left = 0,right = 0:
enter image description here

但是,当我运行我的应用程序时,它仍显示如下所示的底线:
enter image description here

如何删除xib文件的界面生成器中的分隔线?如果不可能,那么进步的方式是什么? (顺便说一句,在界面构建器中这样做是我的偏好)

4 回答

  • 2

    您必须删除tableview的Attributes检查器中的分隔线,如下图所示:

    enter image description here

  • 3

    UITableViewSeparator Style 设为 none

    或者,以编程方式

    Swift 3+

    tableView.separatorStyle = .none
    

    Objective-C

    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
  • 1

    要从 UITableView 删除额外的saparator行,您需要设置 tableFooterViewUITableView

    tableView.tableFooterView = UIView()
    
  • 0

    您似乎正在使用旧版本的Xcode . 如果要删除分隔线,则必须选择 default 选项表单 separator inset 并从 separator 中选择 none .

    Follow this image

    否则,您也可以通过编程方式进行设置

    Swift 3+

    yourTableView.separatorStyle = .none
    

相关问题