setScrollsToTop with multiple UIScrollView classes

2019-07-20 23:02发布

I know that setScrollsToTop gets confused when you have more than one scrollable view, but is there any way to fix this? Can you specify which view to scroll to top, thus clarifying it for the property?

Eg, I have myScrollView and myTableView in the view

How can I set it so only myTableView scrolls to top when the status bar is tapped?

Alternatively, is there a notification that goes off (or I can subscribe too) when the status bar is tapped?

Thanks in advance, I hope this makes sense!

4条回答
爷的心禁止访问
2楼-- · 2019-07-20 23:26

Adding [scrollView setScrollsToTop:NO] to all UIScrollViews that DO NOT need to scroll to top will also fix.

查看更多
仙女界的扛把子
3楼-- · 2019-07-20 23:28

I also found turning off scrolling for all other scrollviews

eg

[myScrollView setScrollEnabled:NO]

will make it work again.

Just remember to turn scrolling off and on as needed.

查看更多
等我变得足够好
4楼-- · 2019-07-20 23:28

I solved the problem by using adding below line. i have Embed in UINavigationController to the specified tableviewController

problem :- Cant scroll top/down tableview cells while using ECSlidingViewController.

Solution :- [self.parentViewController.view addGestureRecognizer:self.slidingViewController.panGesture];

Its works for me.. I dont know whether it is right or wrong

查看更多
男人必须洒脱
5楼-- · 2019-07-20 23:44

If you don't want all your ScrollViews to behave the same way you need to create a new class and set it as the ScrollViews Delegate rather than your current view.

Then you can use all your delegate methods just for that Scrollview.

查看更多
登录 后发表回答