I was trying to use iCarousel for one my app, I need to achieve something like the image below
How to animate sliding Item 2 to Item 1? How to animate the change of distance between the elements?
Animation show only first time when open, then iCarouselOptionSpacing will be always the same.
Related
I am implementing a custom segmented controller via two buttons. Each will be a circle, and the selected one will be filled. I would like to animate the selection of a button so that the "fill" appears to move from one to the other. What is the best way to accomplish this? Should I just use a UIView behind?
I have an image view I want to have crossfading between two images. There isn't a set time I want this animation to take place, however. I want it to be controlled by a slider where they can slide between viewing the two images and having them crossfade relative to the slider's progress.
My question is, is there a better way to do this than overlaying two UIImageViews and adjusting the alpha property for the top one? Is there a way I can manually set a crossfade animation's progress between two images using one UIImageView?
Thanks!
Try iCarousel which will let you do crossfade animations within a single view.
https://github.com/nicklockwood/iCarousel
iCarousel is a class designed to simplify the implementation of various types of carousel (paged, scrolling views)
I have made numerous controls like pickers that had static elements. You could scroll it and pick the number like in standard picker.
But now I need to make a picker that changes its elements based on their position. Here is the image:
I want elements to shift color from white to another color slowly while they are being swiped, and change the size while they are moving. E.G. the central element will be filling with white and getting smaller size and next element should increase in size and fill with other color.
It should also be dynamic, if I go halfway and decide to swipe back, it should work as intended, returning the last central element to its position. So for each pixel I scroll the elements should change.
How do I attack this?
I know the basics, how to call delegate methods, I have this handled, only question is how do I animate this?
I managed to do this with scrollViewDidScroll delegate method, as it gets triggered even if the scroll view was moved 1 pixel.
I set up collection view with cells, and have it send scrollViewDidScroll to each of those cells. Based on the data those cells adjust themselves via CGAffineTransform (for size) and my own written functions that provide relevant color for each offset.
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.
I would like to know how to implement the slider similar to the one in the Ipad default calendar application. I have attached the image below
If you see at the bottom, it acts like a slider which allows us to select any month either by just pressing it or sliding to it.
It would be great if anyone could tell me the name of that control. I tried using UISlider but I see that it allows only 3 options:
setThumbImage
setMinimumTrackImage
setMaximumTrackImage
If that control is indeed a slider control, could anyone tell me how I would be able to insert multiple images/ text
Thanks
It may be more complex than you'd like, but you could make your own:
Make a background that has UILabels for the dates
Make a selection box
In the UIViewController you could put something such as:
touchesMoved -
Make the selection box's x value equal to the touch
touchesEnded -
Make the selection box's x value equal to the touch's last x value
The touches moved would allow dragging of the selection box, and the touchesEnded would allow tap selection.
Then you would simply animate the selection box to the x value.
(This is an extremely simplified version, but you could do this pretty easily.)
This can be achieved by using UIScrollView. Add UIButtons programmatically having background images and text as well on them as per your requirement.
You can refer tutorial1 tutorial2 in which on screen only 1 page(Image) is displayed. You need to do some calculation for applying same logic to fit your requirement. i.e. Your scrollview will be smaller(in height) and bigger(in width) as displayed in image, you will be adding UIButtons in spite of images and most important at a time displaying more than 1 item but it won't be difficult. The Main part is only programmatically scrolling.