Alaa Eldin
Alaa Eldin

Reputation: 2268

UITableView start scrolling position

I have a UITableView, Is there a way to know the start position of scrolling when table is being scrolled ?

I don't think that I can subclass the UIScrollview of UITableView, right ?

Also, I need to know if there is a method to disable vertical or horizontal scroll in UITableView.

Upvotes: 0

Views: 1167

Answers (3)

SamehDos
SamehDos

Reputation: 1203

According to your answer on Niall Mccormack I have observed that you can use

[self.tableView setDelaysContentTouches:NO];

in your tableviewcontroller initialization .

Upvotes: 1

Rui Peres
Rui Peres

Reputation: 25907

  • To disable the scrolling:

[myScroll setScrollEnabled:NO];

  • I don't think that I can subclass its UIScrollview, right ?

Yes you can.

  • To know where you are in the UIScrollView, you can check this answer.

Another thing, your question is a bit confusing (at least for me). I am not sure if you are talking about an UIScrollView, an UITableView, both, or the "scroll" an UITableView has.

Upvotes: 0

Niall Mccormack
Niall Mccormack

Reputation: 1372

I don't quite understand your question.

Do you want to

keep the header view visible as the rest of the tableview scrolls?

If so you can make your header view a separate view that sits above your tableview. This would keep it in position as the rest of the table scrolls.

change the origin of your tableview so that it scrolls back to the bottom of your header

You can change the contentInset of your table like so - tableView.contentInset = UIEdgeInsetsMake(-100, 0, 0, 0)]; so that the table view comes to rest at the bottom of your header view.


Also, I need to know if there is a method to disable vertical or horizontal scroll.

With UIScrollViews you can disable all scrolling by setting scrollView.scrollEnabled = NO or you can control the direction that they scroll by using setContentSize: and setting the width or height larger than the scrollviews width or height to change whether it scrolls horizontally or vertically.

Upvotes: 0

Related Questions