简体   繁体   中英

UITableView footer doesn't locate correctly

I want to keep the footer of my UITableView float.

I did it correctly, but my problem is that, the footer doesn't show all, I have to scroll a little bit to see it, I don't know why.

look please, the footer just shows the top black, not the down black one:

在此输入图像描述

Where I do have in the interface builder both top and bottom black bar 在此输入图像描述

I add the footer easily like this:

override func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        return self.footerView
    }

The height of the footer is managed by the delegate method heightForFooterInSection . You need to pass the correct height of your footer in this method to show the footer completely.

Seems like height of footer in your implementation is cut off slightly. Make a try after increasing the height by 20 px.

只有当您的tableview样式为“UITableViewStyle.Plain”时,页面页脚视图才能“浮动”,否则您需要在自己的桌面视图上方实现自定义的“浮动”视图。

Set height of your tableview correctly. Your table view is going a few pixels down the screen. Setting tableview height will resolve the issue

The footer from the running app and from the storyboard looks different. The one from the app is rounded. Is there any chance there are two footers and you are using the wrong one?

Also you should provide some other information from your storyboard. Some images of your tableview properties for example. I think you are using autolayout. You can't get satisfying answers without these info.

Also you can check this answer for misplacement of your tableview. https://stackoverflow.com/a/27527905/697467

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