Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a UITableView stop scrolling

I don't mean that I want to disable scrolling. I want to be able to programmatically tell the table to immediately stop moving (but then it should still be scrollable after than). Is this possible?

like image 625
MusiGenesis Avatar asked Apr 17 '12 20:04

MusiGenesis


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.

Can UITableView scroll horizontal?

You can add a UITableView to a UIScrollView and have it scroll horizontally.

What is UITableView in Swift?

A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+


1 Answers

A UITableView is a subclass of UIScrollView. If you tell it to scroll to its current position, it will stop scrolling so this should work for you:

[tableView setContentOffset:tableView.contentOffset animated:NO]; 
like image 144
ndfred Avatar answered Sep 22 '22 03:09

ndfred