Move to Specific Page in ScrollView While Hiding Between Pages - iOS - ios

I have Paged UIScrollVIew with 5 pages.
I have a problem where when I tap a button, I need to navigate from the 1st to 4th page. The problem is that it will show page 2 & 3 during this transition. I just want it to scroll to page 4 as if it were the next page in the scroll view.
Here is a diagram:
Any idea's on how to achieve this?

I think you'll have to reposition your pages within the scroll view to make that happen seamlessly. It probably means keeping track of what pages you've moved and perhaps a state engine that restores your original positions when you leave. It would probably be easier to make each page a subview and add that to your scroller, then you need just change each subviews frame as needed.

Related

WkWebview inside uiScrollview

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.

Add refreshControl to a scrollView with pageControl

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).

Horizontal ScrollView Stopping in the middle

I have created a horizontal scrollview in swift with 3 view controllers and it almost works fine except for one thing. When I scroll between view controllers, it is possible for half of one view controller to take up one half of the screen and the next view controller in the other half. I was wondering if there was any way to prevent this so that the view controllers do not get "stuck" halfway and that there will always be only one view controller displaying on the screen.
-Also on a side note I have one left and one right swipe gesture within one of the viewcontrollers in this scrollview, and I noticed that after about 7-10 swipes, the screen no longer responds to the swipe gestures(left, right). Any clues as to what could be solving this?
If anyone could answer or attempt to steer me in the right direction for solving one or both of these questions, it would be greatly appreciated.
First, you need to enable pageing for your scrollview. You should be using something like
scorllView.isPagingEnabled = true
Then most importantly, you to make this paging work, each "page" in your scroll view must has equal width with your scroll view.

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.

UICollectionView - Horizontal paging with 3 pages visible and 1 in the middle using UICollectionView [duplicate]

This question already has answers here:
UICollectionView: paging like Safari tabs or App Store search
(6 answers)
Closed 9 years ago.
I'm trying to implement same feature like mobile Safari has when scrolling among different pages using UICollectionView. One page is in the middle and parts of other are also visible.
I am struggling to achieve such a behaviour using UICollectionView. There is 1 way I found how to put 3 pages at one screen - make pages smaller and set appropriate insets. But as soon as I set pages smaller and I set paging enabled, pages are not scrolled to the centre as they should. I can also leave paging disabled and use this method in subclass of UICollectionViewFlowLayout:
- (CGRect)rectForTargetPageForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
In this method I can set exactly where UICollectionView will stop. However, scrolling experience is not as good as it was as using UIScrollview with paging enabled. When I swiped with bigger velocity, several pages were scrolled and it stopped on proposed page. What I want to achieve is same behaviour as normal scroll view with paging enabled - whatever velocity I use, I will get only 1 page more.
Do anyone have any idea how to solve this using UICollectionView?
So you want to make size of a page smaller than the size scroll view, right? Page size is always the same as the size of scroll view, so you have to make the scroll view smaller.
Then there is another problem. How to receive touches out of the bounds of the scroll view?
Override -[UIView pointInside:withEvent:] of the scroll view to check for larger bounds than they really are. Then the touches should work.
In fact I didn't try this myself, I was doing it by placing supplementary view above with desired bounds and override -[UIView hitTest:withEvent:]. Inside I modified the point and called scroll view hit test. This way the touches were handled by scroll view, but their position was wrong. You may want to try combining these two approaches to get correct position.

Resources