SwiftUI ScrollView - ios

How do I achieve similar behaviour of ScrollView like in iMessages app? I mean, if you are scrolling on top, new messages will appear without pushing existing content down. Same if you get new message and you are not on the bottom, does not push items top.
If you are adding items to the end of index, it's fine. ScrollView keeping user point of view. However when user is on the top of the scrollview, and add some new items at startIndex, all content is pushed down.
I did trick and I flipped whole ScrollView with .rotationEfect and then also used rotationEffect on every item. So scrolling is from the bottom to the top. Now when I add something at start index, does not push content down but adding at end index will push content.
Also this flipped trick with rotation effect break .contextMenu functionality.
How can I achieve scroll view which is like in messanger, whatsapp, viber and rest of the chat applications?

Related

Controlling scrollbar from controller in Flutter

I have made a list horizontally scrollable, but I want to control scrolling from a specific widget. In the diagram if I hold the bottom video progress bar and move it on right it should make the screen scroll. Also it adjusts its position when I scroll list horizontally by sliding the screen. I have all the widgets made. I just want to know how to sync them.
.
You can use position in scroll controller. For example - if I have to perform an operation when user reaches end of list of widgets, this is the condition -
if (_scrollController.position.pixels ==
_scrollController.position.maxScrollExtent) {}

Scroll to bottom of ScrollView on iOS using Appcelerator

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

How to make auto expandable home page banner like

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.

Creating an animation such as iOS 8 Weather App

I want to create a view in which I like to have animation such as the one present in iOS 8 Weather app.
I try to explain more what I have done. If anything is incorrect please guide me.
In the top I put a label for the temperature. (The big one)
Below that label, I put another label to show some text. In the Weather app, there is the horizontal scrollview showing the hourly forecast.
Next is the Table view.
What I want to achieve is that when I start scrolling, the first label disappear smoothly and the second one go to top of the screen and the TableView stretches to show more content.
When I scroll back to the top, I want the whole process to revert.
What is the best way to do this?
I've recently re-created the iOS8 Weather app's scrolling effect for an app I'm creating.
The complete code is too long to post here but for anyone who's interested, I've put it on GitHub. You can download and run the project to see how it looks. Improvements to the code are welcome:
UIScrollView with masked content.
It works like this:
You have one scrollview (the size of the screen), which contains a subview (the mask) which in turn has a subview (the content). We also add a large label to the top of the screen (in the Weather app, this displays the temperature).
Then you use the scrollViewDidScroll delegate method to keep the mask fixed to the screen as the user scrolls. You also use this method to stretch the mask upwards at first.
Fixing the mask to the screen means that the mask's subviews (our content) also becomes fixed. But we want it to scroll, so we do the opposite to the content of what we did to the mask (again, using scrollViewDidScroll).
We need the mask to actually behave as a mask, so we set clipsToBounds = YES on the mask.
Finally, we use the scrollview's offset during scroll to move and fade the big label at the top of the screen.
To make it behave exactly like the iOS8 Weather app, we need to also do the following:
Cancel any scroll touches that happen above the mask, i.e. over the large temperature display.
Ensure that the initial scroll that moves the temperature display is completed programatically if the user doesn't complete it.
Add a sideways-scrolling subview which is anchored to the top of the mask.
I haven't done these yet, though.

What is the best way to animate the size of sub view in a UIScrollView?

I've got a scrollview that allows the user to scroll between different pages and then tap on one to have it expand so that they can read the page in full, a little like how one changes tabs in Safari on the iPhone. Changing the frame size of each sub view is a bit of a pain when rotating as the scroll position is getting lost as the content size of the sub view has to change too. I was wondering if there was a more effective way of
resizing the views for entering 'viewing' mode or rotating the device.
The solution to your first problem is when you want to expand the view, pull it out of the scrollView then add it to self.view.subviews with an appropriate frame, then animate the frame to fill the screen. When done with it do the reverse, shrink it, then when its back to the appropriate size stick it back in the scrollView.
If for some reason this does not work - the scrollview is showing other stuff that gets moved when you remove the view, then instead of just removing your view from it, create a simple UIView of the same size as the view you will expand, and essentially replace the view you pull out with the "placeholder" view.

Resources