iCarousel rotary mode scroll views one by one / pagination - ios

I'm using iCarousel in rotary mode. I'd like to have my views scrolled one by one in a paginated way. I've tried many settings but couldn't manage to do that.
The settings i'm looking for is a bit like "pagingEnabled" in UIScrollView, but with the addition that a swipe motion should never scroll more than one view.
I tried to perform "[stop animation]" in the "carouselCurrentItemIndexDidChange" method without luck.
I first thought that stopAtItemBoundary property would let me do that, but it doesn't. I just means the carousel will stop at an item, but i lets the user swipe more than one at a time.
Anyone ?

set decelerationRate to a lower value like 0.5.
You may need to tweak this value to suit your view sizes, but it will have the effect of reducing the distance the carousel moves when flicked.

Set 'isPagingEnabled = true'. This would help
This is available in latest version of iCarousel. But it won't help in auto scroll though.

Related

How to pin an image/view inside a UIScrollView when scrolling

I've been searching for a way to pin views/images to the top of a UIScrollView when scrolling. However the posts/articles I came across are not in swift 3. I'm not sure if I'm typing my question in the web correctly. So my question is how can we achieve the same behavior as a UITableView or UICollectionView. When you scroll, a section will stick to the top until another section pushes it up. I'm wondering would we be able to use views/image and pin them at the top of the UIScrollView. Down below is a screenshot of a UIScrollView that has 4 views.
So when scrolling I would like to pin the first view/image to the top until another view/image pushes it. Also would it be possible to determine which view sticks to the top. So lets say I only want the red views to stick until another red view pushes it. Been looking for a way to achieve this type of behavior for a while now.
Please help, would really appreciate any help provided at this point. Thanks.
A few ways to do this, but you can use the scrollView delegate’s scrollViewDidScroll to capture the contentOffset and use a combination of the target view’s origin/center/transform properties to keep the view where you want it.
There’s a neat video explaining how to do this that Apple released during WWDC 2010, called something like “Advanced Scroll View Behavior”, if I remember correctly. It’s definitely worth a watch.

scrollsToTop and multiple scrollViews on-screen

I'm currently working on an iPad app that should feature two UITableViews side-by-side (unfortunately, they can't be combined into a single one for some specific reasons).
As far as I know, scrollsToTop won't work properly for both of them, since only one scrollView should have this property enabled at a time. The thing, the app could really use this feature for both tableViews, but I haven't figured out how to do it.
Is there any workaround that would allow me to have scrollsToTop enabled and working for both of them? Or maybe disabling it on both and then listening for touches on the status bar so the app can determine above which tableView they happen and scroll as appropriately? Or any other clever solutions?
Edit: tableViews shouldn't scroll up together. Each should scroll only if the tap on the status bar is right above them (just like if we had two iPhones side by side, for the lack of a better example).
If you have many scrollviews this category is really useful.
-[UIScrollView makeOnlyThisScrollViewScrollToTopOnStatusBarTap];
https://gist.github.com/hfossli/6776203
It basically sets scrollsToTop to NO on all other scrollViews than the one you are specifying + taking care of the default value.
There's a scroll view delegate method scrollViewShouldScrollToTop:. Implement the method on one table view and in the method body tell the other one to also scroll to the top (probably with setContentOffset:animated:).

Simple Picture based App

I'm developing a iPad app which is just a series of pictures, and I'm stuck. I've managed to link up a Tab Bar Contoller to the 6 View Controllers and all seems to work well. But I'd like to be able swipe to the next View Controller once the user has selected the button. How do I do this? The swipe gestures don't work for me. Here's a snapshot:
I think you are looking for UIPageController. This is the control that is used in the iPhone Weather app to allow you to swipe from city to city. Go here to see the full documentation on the control.
That's not usually how Tab Bars work in iOS, but…
What it sounds like you're after is either a UIScrollView with paging enabled (keep in mind you'll have to set the scroll view's ContentSize) or a UIPageViewController (if you don't want to deal with sizing explicitly and you're OK making a new UIViewController to house each image). I'd recommend the first option. The process would go something like:
Add the UIScrollView as a subview of your main view (remember, ensure to set pagingEnabled to YES
Add each image to the scroll view
Set the scroll view's content size to the total width of all images
Thanks for the clarification!

Fast custom animation using CADisplayLink causes stroboscopic effect. How to avoid it?

Scenario:
Horizontally scrolling UIScrollView with reused page views (so that there are only few page viewcontrollers which are being reused similar way like UITableView cells). So that they are able to be updated with new content and reused I need to know exact position of UIScrollView's content view (offset). This works great.
Now I need to implement custom scrolling animation - I mean to programatically move the content view, so that user touches some buttons, and the scroll view scrolls to desired position with this custom animation. The movement can be very quick and very far. I can not use Core Animation for this, as I could not track position during animation (CA reports you only start and end of the movement). So I decided to use CADisplayLink, and calculate each UIScrollView content for each position. This works great too.
The only problem is, that sometimes I see stroboscopic effect - say I am moving the content to the right, and it looks like it is moving to left. If I look at builtin animation within UISCrollView using setContentOffset:animated:, the animation is smooth and nice. Does anyone know, how to get rid of this stroboscopic effect?
Most likely your issue is that timestamp is a double and you're assigning it to a float
Floats have 7 digits while Doubles have 15-16 digits.
So in other words you're experiencing data loss. By using double you should see a silky smooth animation.

Fluid full screen view transitions on iOS

I have a simple app that has a set of coloured views, one red, one green and one blue.
I am trying to make it so that when a swipe gesture is made the current view will switch to the next one in the list in a fluid manner, it looks like moving a long piece of paper with different colours on it.
Is there a way to do this (CoreAnimation)?
You could first look into UIScrollView. It seems to me that what you are trying to accomplish is the same you have, say, in Mobile Safari on an iPhone, when you show all your current pages and can go from one to the next by scrolling. This tutorial is particularly close to what you describe.
If you are looking into more advanced kind of transformations, than Core Animation would be the option.
Actually, nothing prevents using both approaches, UIScrollView to handle the swipe, Core Animation to add more animation to the pack...
You could use a UIScrollView to accomplish this. Add all of your colored views as subviews to the scroll view. Make sure your contentSize is setup appropriately and optionally setup paging to make the scrolling always snap to a certain border. See the scroll view programming guide for more info Scroll View Programming Guide

Resources