Disabling bounces in uitableview also disables scr

2019-06-20 08:43发布

问题:

I have an app with a table view in a nav controller; I wanted to disable bouncing so that when my table is in Edit mode, user can scroll down and find rows to delete; otherwise, it would bounce back and not give them the opportunity to press the delete icon next to the row.

So I did this:

self.tableView.bounces=NO;

When I run my app on iOS 4, this works like a charm. User can scroll and the table does not bounce back.

But on iOS 5, the scrolling is also not working at all for the table. No scroll. So to be safe, I did this:

    self.tableView.bounces=NO;
    self.tableView.scrollEnabled=YES;

But this made no difference.

I create my table view and its nav controller programmatically; everything else is working fine with them. Any idea why disabling bounces would also prevent scrolling on iOS 5?

回答1:

I found the solution here:

UITableView won't scroll after editing view frame and origin

If you manually set the origin of the tableview, on iOS 5 it disables scrolling. on iOS 4 it is not. a shame, really.