Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable/disable scrolling in UITableView?

I know about this command:

self.tableView.scrollEnabled = true

The question is: I want to lock scrolling according to the scrollView position. For this I do:

let topEdge = scrollView.contentOffset.y
    let followersViewEdge = CGRectGetHeight(self.profileView.frame) - 50

    if topEdge >= followersViewEdge {
        self.tableView.scrollEnabled = true
    }

it works, but the problem is that it does not lock or unlock the scrolling immediately. For locking or unlocking the UITableView scrolling I need to release my finger from the screen and scroll again. In this case it works.

I want to make it immediately, so it locks and unlocks the scrolling while I'm swiping on the screen. How can I do it?

UPDATE

My code works. It's not a problem. Problem is that I need to make these changes immediately, without releasing my finger from the screen.

So, do not answer me how to lock scrolling! I know how to do this.

like image 239
John Doe Avatar asked Mar 01 '16 11:03

John Doe


People also ask

Is UITableView scrollable?

UITableView scrolls back because it's content size is equal to it's frame (or near to it). If you want to scroll it without returning you need add more cells: table view content size will be large then it's frame.


1 Answers

  1. Select tableview
  2. choose Attribute insepector
  3. In scroll view section, uncheck Scrolling Enabled property
like image 175
Avinash Jadhav Avatar answered Oct 20 '22 01:10

Avinash Jadhav