22

I am using a UITableView with UITableViewCells and I want to stop the "over" scroll that you get at the top and bottom of the list, The bit where you can pull down on the very top cell to show the background (sometimes used to refresh) Is there anyway to just make the top edge of the cell the "absolute top"? so the view only ever shows just the cells?

craft
  • 2,017
  • 1
  • 21
  • 30
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294

5 Answers5

36

Since UITableView is a subclass of UIScrollview, it should suffice to just set the 'bounces' property to NO.

Edit: you probably need to set'alwaysBounceVertical' to NO, too...

Toastor
  • 8,980
  • 4
  • 50
  • 82
  • 1
    Much appreciated, [[self tableView] setAlwaysBounceVertical:NO]; on its own did not work, but [[self tableView] setBounces:NO]; did, thank you Sir. – fuzzygoat Jun 05 '13 at 11:02
9

You can use this code to solve your Problem

self.objBackTableView.bounces = NO;

And used Below code to if data is fit on screen than its not scroll

self.objBackTableView.alwaysBounceVertical = NO;
saraman
  • 568
  • 7
  • 19
8

You can set the tableview bounces property to NO.

Adithya
  • 4,545
  • 3
  • 25
  • 28
4

Swift 4.2:

It's not scroll at all:

tableView.bounces = false

It's not scroll if there is enough space for cells:

tableView.alwaysBounceVertical = false

Hope to be useful.

Stedy
  • 7,359
  • 14
  • 57
  • 77
Abbas Habibnejad
  • 433
  • 5
  • 14
0

Interface builder

  1. Select table view in Document Outline on left side
  2. Navigate to View Inspector on right side
  3. Uncheck Bounce Vertically

enter image description here

craft
  • 2,017
  • 1
  • 21
  • 30