简体   繁体   中英

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.

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.

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]; or self.tableView.separatorStyle = UITableViewCellSeparatorStyle.SingleLine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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