How can I prevent a Tableview from snapping back to the top? - ios

Currently in the app I am making, I have a tableview. The issue is that when I try to scroll, it always snaps back to the top rather than letting me scroll through the entire list. I assume it is simply a setting in the storyboards, however I haven't been able to find it. Here is a video of the issue:
https://youtu.be/wSUb9ofFASM
Additionally, here are my scroll settings:
Please let me know if you have any idea as to how to fix this so that the user can freely scroll through the items in the tableview without always being sent back to the top.

Remove equal height and add bottom constraint of table view to 0

Related

iOS controlling the scroll position of UIScrollView?

I'v some strings of different size in an array, i added them to UIScrollView by using UILabel
user can scroll horizontally to see all the names.But i want when user scroll either side he should see next/previous name from list as we do in paging enabled scroll view but here i want only one name(of different size) to be scrolled, not the whole screen.How to achieve this?Any help or suggestion would be highly appreciated.
Edit: - for better understanding suppose initially 0th, 1st and 2nd strings from my array is visible on scroll view, and when user scroll it should show 1st, 2nd and 3rd strings from my array(and vice versa for scrolling to other side).
You can do this by contentoffset.
set contentoffset of scrollview and you can able to do this.

Scroll a view except a part of it

I want a screen with scroll, and I want to scroll until a part of the view. When I reach this, this part will be fixed on the top and you can go on scrolling. In the image:
You begin scrolling until the buttons part, then, the buttons stay fixed in the top and you can scroll more. It's like the spotify app effect in the lists, more or less, if you know it.
Thank you in advance
You could probably achieve this by implementing the -scrollViewDidScroll: method in your scroll view's delegate. When the view scrolls, check the offset to see if the button is visible. If it is, and if it's close to the correct position, you could remove it from the scroll view and position it above the scroll view in the position you want.

How to use scrollview to a viewcontroller with UILabels and TableViews

My TableView rows varies in size. I want to scroll it down.. But I don't know how to use a scrollview.. I've added a scrollview below the other content views.. I also assigned an IBOutlet, but i don't know what to code or something.. Also it works but it bounces back to the viewable screen only, I need to hold the screen to steady the view.. How do I fix this?

UITableView stops scrolling enough after I add/remove a view to the superview of table view

Here is the problem that I'm facing. I have UITableView inside main view. When user taps menu button, view is added to the view hierarchy of superview, and this view covers all screen, except the menu button. That is I call
[self.view insertSubview:self._menuView belowSubview:self._menuButton]
After user clicks the menu button again I call
[self._menuView removeFromSuperview]
However, after this, the UITableView stops scrolling, actually it scrolls, but just a little, couple of pixels, and then bounces back to the location on which it was before I inserted _menuView. I've monitored the menu hierarchy after inserting and removing the _menuView, it is actually removed, and also there is no view which covers the UITableVIew, so there is no chance that some other view steals touches from UITableView. What can be the problem? Any ideas?
EDIT 1: I've noticed besides not being able to scroll, another strange thing happens. When I show menuView, the tableView is scrolled to top, without animation. (the menuView is half opaque only, so I can see the tableView underneath it)
EDIT 2: I've monitored contentSize and contentOffset of tableView before and after inserting _menuView, the reason for not being able to scroll is that somehow contentSize is being changed.
TABLE VIEW BEFORE INSERTING MENU - contentSize:{Width=320, Height=10519} contentOffset:{X=0, Y=3980}
TABLE VIEW AFTER INSERTING MENU - contentSize:{Width=320, Height=44} contentOffset:{X=0, Y=0}
As You can see, the height is changed to 44 that's why I'm not able to scroll. And Also, as I've said in EDIT 1: tableView is scrolled to top - so as you can see contentOffset is also zeroed. Any ideas why content size changes automatically?
Thanks in advance.
i think there is problem with your tableview frame. right after removing subview, try to set frame of your tableview at its original frame.may this will solve your problem
Content in the UITableView organized automaically and designed only to show cells & header/footer elements. To proper working you should wrap your table into parentView and add your menu to that parentView rather than to the UITableView. You can also try to call reloadData method on table since it can restore the content size of the view.

UITableView Section Headers not visible when table in visible rect

I have a UIScrollView with 3 UITableViews stacked horizontally. I switch between these tableviews using a tab-controller on top. However, when I switch to the 2nd or 3rd tab and switch back quickly to 1st the section headers don't show. They display when I scroll the tableView. These are custom headers (jfyi). I tried calling setNeedsDisplay when the tableView is visible, but that does not help because as per Apple Docs :
If you simply change the geometry of the view, the view is typically not redrawn. Instead, its existing content is adjusted based on the value in the view’s contentMode property. Redisplaying the existing content improves performance by avoiding the need to redraw content that has not changed.
Since, only the geometry of the view is changing here, it does not help. Also this happens on all versions iOS 5~6.1 and on simulator and device. Thankfully, this does not crash the app, but its a problem nevertheless. Could someone help? I am attaching pictures for reference. First shows the problem, second: after scrolling the "head(er)less" tableview
EDIT:
I am using simple scrollRectToVisible:animated: to switch between tableviews. This does the trick but I just observed that when I set ...animated:NO all is okay. The problem happens when ...animated:YES
It seems the issue of displaying and scrolling taking place simultaneously for the respective tableview. So what you can do here is:
Remove the scroll animation
or
Just scroll the tableview to top on the tab press event
or
simply reload the tableView which is made visible

Resources