sarah
sarah

Reputation: 1221

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:

enter image description here

Where I do have in the interface builder both top and bottom black bar enter image description here

I add the footer easily like this:

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

Upvotes: 4

Views: 935

Answers (4)

deoKasuhal
deoKasuhal

Reputation: 2897

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.

Upvotes: 1

mkeremkeskin
mkeremkeskin

Reputation: 644

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

Upvotes: 0

Ali Jawad
Ali Jawad

Reputation: 151

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

Upvotes: 0

Oleg Sherman
Oleg Sherman

Reputation: 2802

A section footer view can "Float" only if your tableview style is "UITableViewStyle.Plain" , otherwise you need to implement a custom "Floating" View above your tableview by your self.

Upvotes: 0

Related Questions