4

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
    }
Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92
sarah
  • 1,201
  • 1
  • 9
  • 29
  • are you passing correct height for footer in the delegate method ? I am assuming that this tableView is plain table view – deoKasuhal Dec 25 '15 at 16:44
  • @Dev this is not a plain table view, but it is a UITableViewController, and I showed you already how I'm adding the footer – sarah Dec 26 '15 at 12:00
  • what is the value that you are passing into `heightForFooterInSection` method, This method is responsible for height of footer and seems like height of footer in your implementation is cut off slightly. Make a try after increasing the height by 20 px – deoKasuhal Dec 26 '15 at 18:01
  • @Dev wow that solved my problem, i didn't know about this heightForFooterInSection to do that, please write an answer to accept it. I really appreciate the efforts. – sarah Dec 27 '15 at 15:20

4 Answers4

1

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.

deoKasuhal
  • 2,867
  • 20
  • 27
0

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.

Oleg Sherman
  • 2,772
  • 1
  • 21
  • 20
  • sorry but first of all, i'm not asking about how to make my footer float, i already did that. i'm asking about when my footer doesn't show all of it? i have to scroll a little bit to see the down part – sarah Dec 16 '15 at 10:16
0

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

Ali Jawad
  • 151
  • 1
  • 13
  • also sorry but the content of my table view is dynamic, and as I said on the question I already made my footer float at the bottom of the screen always. My problem is that the footer doesn't show all of it, i need to scroll a little bit to see it all – sarah Dec 16 '15 at 19:54
0

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

Community
  • 1
  • 1
mkeremkeskin
  • 644
  • 10
  • 27
  • the rounded button in the running app is because at code, i do the rounding myself. what other information do you need about my table view? it is a very simple table view that has a custom table view cell, i can give you anything you want, just tell me please – sarah Dec 24 '15 at 17:27