I'm looking to perform quite a simple task using Appcelerator, to send my user to the bottom of a scroll view after they have posted a message.
So, inside my scroll view is a simple tableview.
At the top is a post box, where can type a message, and on submit the comment gets posted to our API and the view refreshes. However, my client would like the user to be scrolled to the bottom of the view, as this is where the latest comment is posted (a bit like Facebook).
I can't see to get the content height, it is just returning 'auto' when I try and get it using scrollView.getContentHeight();
Any ideas how this can be achieved?
My scrollView is this:
var scrollView = Ti.UI.createScrollView({
contentHeight:'auto',
layout:'vertical',
top:60
});
What I need to do, is calculate the height of the scrollview and then, if i'm right, set the contentOffset of the scroll view to the height, in order to get it to scroll to the bottom.
Any help would be appreciated!
Simon
Related
I was wondering if you can help me please. I have a wkWebview that has horizontal paging content.
Outside of that I have a scroll view that also has horizontal paging content.
There is obviously a conflict when scrolling and I was wondering what is best to solve the issue.
I want a continuous scroll that when scrolling on the web view that has a content offset less than 0 I want to scroll the parent scroll view to the page before. When the content offset is greater than the size of the content size I want to go to the next page.
I considered using a pan gesture recognizer. However I can’t seem to get it working properly.
When the web view decides to call the parent setContentOffset method how do I make sure that it behaviours like it is paying the content?
Hopefully that makes sense.
Please help.
As it can be seen in the gif from the link, I was able to add the refresh control to the scrollView but it is only shown for the first page. It still works for the other pages but it is not showing the refresh indicator which might be confusing for the user.
I have tried already a couple of ideas but nothing seems to work.
I am looking for a solution, which either only makes it possible to use the refresh control on the first page and disables vertical scrolling for the other pages or a solution which shows the refresh indicator at every page.
I would also like to disable the diagonal dragging. I added this in case there is a solution which solves both problems.
https://giphy.com/gifs/KfqJnVlwKE9fwFc07R/html5
Help will be very appreciated.
The indicator looks like it is probably added as a child of the scrollview, meaning it is scrolled along with the other contained views, and hence scrolled off-screen.
For an element you want to always be displayed over the scroll view add the indicator as a sibling of the scroll view (i.e. a subview of the scroll view's parent).
I have used the separate banner image and scroll view for category sections and tableview for records.
Need to make all things scrollable to topside and when the scroll position reached the top position category section would fixed at top position and the table view records would continue scrolling and once the scroll down all the object would displayed to their original position back to back well which is normally happen in android apps and whatsapp profile page.
Please share your answer if you have done like this.
Here is the link for DTParallaxTableView
QMBParallaxScrollViewController
This Library same you want MXSegmentedPager
May this helps lot.
I'm wondering how did Twitter implement it's profile screen. At first I thought it is a table view with a header (profile info) and section header (segmented control to choose tweets/media/favorites). It would make sense for me as the profile info goes away while user scrolls down, but segmented control stays, and that's exactly behavior of plain UITableView header view and section header. There is also an image view at the top, under navigation bar, but that's not what's important for me. Here's a visualization of what I think it is:
I tried to recreate it in Interface Builder and that's what I got. The slider drew my attention: it's different than in Twitter app, it starts at the top of table view header, not at the top of cells.
So… how did they achieve it? Did they put a UITableView in a UIScrollView and handled touch/scroll events themselves? I don't think so, since it's discouraged, but I can't think of another explanation.
I'm not sure about the slider, but here they did pretty good job with mimic twitter profile view. So take a closer look, maybe you'll find this helpful.
You can adjust the height of the scroll indicator to sit below your header using
tableView.scrollIndicatorInsets = UIEdgeInsetsMake(yOffset, 0, 0, 0)
yOffset would be the current on screen height of your header. If you adjust this as the user scrolls down using the scrollViewDidScroll method from UIScrollViewDelegate, it will achieve the smoothly changing effect that twitter uses.
This page goes into more detail on creating the twitter profile effect, building on the method described in the link supplied by njuri above including changing the scrollbar to be correctly positioned.
When I load the page, my scrollview works perfectly, but when I navigate away from the main page and I try to return to it, the scrollview forgets where the top of the scrollview ought to be. It thinks that the place that I left the scrollview at before navigating away is the top of the list, and it thinks that the bottom of the list is somewhere beyond where the bottom actually is, thus it allows the user to scroll to far and then the scrollview disappears and cant be recovered unless i call scrollTo in the console.
I have tried doing scrollTo(0,0) on pagehide and beforepagehide with no luck -- the page will begin at the top when its shown, but it will immediately scroll down.
Here's how to reproduce the issue:
1) Go to http://7.latest.foodtrucksmap.appspot.com/m/la
2) Scroll down the list and select the detail disclosure on one of the cells.
3) Hit the 'Map' icon in the header to return to the original view.
At this point the scrollview will be in the state I've described.
Thanks a lot for the assistance in getting this resolved.
I resolved this by calling $('#list_content').scrollTop(0) on pageshow