简体   繁体   English

Xcode UITableView放置和单元格分隔符

[英]Xcode UITableView Placement and Cell Separators

I am having a problem where my UITableView is not extending all the way to the bottom of the page even though I have it set up so that I believe it should. 我遇到了一个问题,即使我设置了UITableView,但UITableView并未一直延伸到页面底部,所以我认为应该这样做。

Table doesn't extend to bottom 表格未延伸至底部

Also, the cell separators do not seem to show up unless I scroll the table. 另外,除非我滚动表格,否则似乎不会显示单元格分隔符。

Cell separators show up only on scroll 单元格分隔符仅在滚动条上显示

Try to set the property automaticallyAdjustsScrollViewInsets to NO like this. 尝试像这样将属性自动将AdjustsScrollViewInsets设置为NO。

self.automaticallyAdjustsScrollViewInsets = NO;

or 要么

self.navigationController.automaticallyAdjustsScrollViewInsets = NO;

EDIT: 编辑:

from your screenshots its seems to be constraint problem. 从您的屏幕截图来看,它似乎是约束问题。 Try setting constraints left, right, top, bottom and try again. 尝试将约束设置为左,右,上,下,然后重试。 You see the yellow line coming and a warning regarding the constraint problem. 您会看到黄线和有关约束问题的警告。 When it goes your table view will work fine. 当它运行时,您的表视图将正常工作。

在您的viewDidLoad方法中,添加以下内容:

self.edgesForExtendedLayout = UIRectEdgeBottom

For the separator issue try setting the separator style [[self tableView] setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; 对于分隔符问题,请尝试设置分隔符样式[[self tableView] setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; or self.tableView.separatorStyle = UITableViewCellSeparatorStyle.SingleLine self.tableView.separatorStyle = UITableViewCellSeparatorStyle.SingleLine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM