Scrolling whole Image from UICollectionView - swift

I have a UICollectionView with UIImage and when i tap on the Cell it´s comes a whole UIImage. I want to Slider Right or Left on the whole Image then show the next UIImage from the UICollectionView like a Photo Gallery. How can i make that ? Thanks for Help.
UICollectionView and Whole UIImage

You could use a UIScrollView for that, large enough to carry 3 images, the current one, the previous one and the next one. The largest is in the middle. The scrollview scrolls horizontally. Then you react on scrolling (and gestures) and when the user scrolls to right or left then you scroll your scrollview to the middle again and realign the 3 images by discarding one and adding a new one dependig on the direction the user scrolled.

Related

Swift/UIKit How to create a CollectionView that peeks the prev/next cells and snaps to center?

I have a UICollectionView that displays some cards, one a time. What I would like to do is have something like the attached image, where the current card stays in the center but the Collection View previews part of the previous and next cells. Playing with cell size, insets and line spacing breaks scrolling because the cells gradually become less and less centred. Do you have any tips on how to achieve this behaviour?
collectionview with peeking cards

rotation of images in UIScrollView

resizing images inside UIScrollView when rotating the iphone.
I have a series of images placed on the UIScrollView (some images are placed one on top of the other). When I rotate the scrollview at some page, the topmost image on the hierarchy is expected to rotate which happens but the image goes to the first page of the scrollView. Any help on what could be going wrong would be appreciated.
thanks
DKV
I think the imageView which is misbehaving w.r.t to its frame is not added into correct super view. I think you should check that all imageView are added onto scrollView (if you want to show one imageView above another imageView make frame of both the imageView same, avoid adding one imageView onto another imageView).

How can i move images on touch event?

I have created a image gallery. I show all images from plist file in navigation view. When i open image in full view after that i have to back in navigation. But i want to move images in scrolling when image in fullview. After open image in full view i want to swap one by one next as well as previous...
Is there possible..??
Plz give me help about any kind..
Regards....
Yes thats possible, make your fullview a scrollview with its contentsize having the same width as your screen and its height being the combined height of its subviews (put at least two or 3 imageviews in the scrollview as subviews). You can add and remove UIImageviews as subviews of the uiscrollview as the user vertically pages through them. You will need to communicate with the navigation view what the table status is when your user returns to that view though so that everything matches up.

2 UIScrollView detect current page and loading correct ppage

First part of the question: Detecting current images being displayed in scrollview A and B
i want to place two UIScrollViews in my main view. Very simply done. So ive placed UIScrollView A above UIScrollView B.
so it looks like this:
Graphical representation
________
| A | ScrollViewA is above ScrollViewB
|______|
| B | ScrollViewB is below ScrollViewA
|______|
There will be images which the user can flick through left and right on both ScrollViews.
They both show different set of images.
First i want to know how to detect which image the both scrollviews are on. for both A and B.
so i should be able to detect which images are being displayed on scrollviewA and scrollview B
eg: UIScrollView A is on image 12 and UIScrollView B is on image 67.
Second part of the question: Loading images on both scroll view as user scrolls from left and right
Because there will be many images in ScrollViewA that the user can scroll from left to and right; and many images in ScrollViewB that the user can also scroll from left to right; obviously i dont want to load them all into the scroll view. Whats the best way i can load them in a scrollview?
an idea is if a user is on image 5, then the user flicks to the left, then the next image will be 6 so only load that image. and so on.
Can everyone help me on how to implement such a thing. Thank you.
All your ideas and help will be appreciated.
On loading images, you can do this:
Load current image
Buffer load next and previous images and position them outside the bounds of the visible view
When user flicks left, move right image into view, unload the left image and buffer a new right image. Do the same thing for the right one.
This way you will only have 3 loaded at a time for a scrollview.
On keeping track of which image is loaded, you have to keep track of that yourself.

Scrollview and image dragging issue

I have a scrollview that has a number of custom imageviews in it. I use the custom imageviews as I need to be able to drag any one of them off the scrollview and to another location on the iPad screen, bit like a photo picker.
Problem is if I want to scroll the scroll view most of the time the custom imageview gets the touch and moves rather than the desired scroll?
I notice in the sample code from Apple using the autoscroll example that they have the same issue but they have left a large gap between the images....ugly!
Is there a way to let the app know when you want the touch to be a scroll and when to be a drag?
Thanks
You could make a drag require holding for 1 second, similar to the behavior of the home screen when in editing mode: if you want to scroll, you just flick; if you want to drag, hold down for a moment until the icon enlarges, then you can move it.