slideshow of a collection of images managed with uicollectionview - ios

I'm using a UICollectionView (with horizontal layout) to manage a collection of images. The view controller that manages the collection view has the bottom toolbar visible with a play button to start a slideshow of the images in the collection. My question is what is the best way to implement a slideshow that involves a collection view? My initial thought was to try to make the collection view changing the visible cells with a UIView transition (transitionFromView or transitionWithView) with a cross dissolve option but I didn't get the effect I was expecting (maybe something wrong in my code). The other idea I had was to simply add a subview to the collection view to handle slideshow. This subview would have access to the data source and be able to iterate through the images. Don't know if this last option is a good way to approach the problem. Anyone has ever tried this and/or what would the recommendation be to solve this problem?

My idea is no need of collection view. In scrollview place imageview which display images. In timer Change the offset of scrollview. so it looks like automatically images are changing as like slide show.

Related

How create a tableView that covers an image when it is scrolled

I'm trying to develop something like CSStickyHeaderFlowLayout but customized for my table, but I'm not sure how can I achieve this goal. The idea is
Someone can give me a hint how achieve this objective?
To add to Vollan's answer, to make the title stay still you could use a view that contains two subviews: the first is the scrollview (with the image and table as Vollan suggests) and then add another view (like a UILabel) for the title. Thus, while the image and table scroll in the scrollview, the title will stay still.
Best solution would be to wrap everything inside an UIScrollView. That will allow you to scroll to bottom of the screen and then only scroll the tableview. That way it will appear like the tableview will overlay the image.
While using a tableview within a scrollview would likely work, your tableview would have to always be it's full size (without some annoying constant re-sizing), so you'll lose the value of the enqueuing/dequeueing that makes tableViews work so well.
The CSStickyHeaderFlowLayout has example pretty similar to what you want to do, did you look at their examples? You may be able to play with it and get it to do what you want If your problem is simply having a constant title, you can just add a view above the table or use the NavBar and adjust the contentInsets
You might also consider using a collectionView instead. It's much more flexible as far as layout goes.

UIPageControl or Horizontal UICollectionView?

I am looking to achieve a similar effect to the Netflix app where at the top they have a scrollable header displaying different 'featured' movies.
As soon as the header start to scroll and the next image enters the view it downloads the image, also while being scrolled if you let go it snaps into place the image that was currently being shown the most.
I am not sure how to proceed and try to solve this problem. Any suggestions? should I look at using UIPageControl, or should I use a horizontal UICollectionView?
Thanks
You can implement it by using a horizon collection view,it can help you handle the reuse of imageViews!Or you can use a UIScrollView to contain a couple of subViews to display the image or three subViews and switch the image content

How to zoom on UIView

In my iOS app I want my users to be able to zoom in on the screen. My main uiview contains several subviews which contain images. I want my uipinchgesturerecognizer to either change the scale, or ideally use some "zoom" rather than scaling each subview.
Please and thank you.
This can be accomplished with UIScrollView. First create a scroll view as the base of your view hierarchy, putting your previous container view as a subview of the scroll view. Set the delegate of the scroll view to self and implement the delegate method viewForZoomingInScrollView, in which you should return the view that will be zoomed in (your original container view). This will allow the user to pinch and zoom your original UIView.
It's hard to provide advice on this without having a clearer view of what exactly you want to achieve.
Can you include a link to a sketch? For example, do you want the individual subviews to remain the same size but the layout to change ? Do you want the individual subviews to resize but their contents to be upscaled?
If you simple want to treat the subview as (basically) a single image which just happens to have other images in it, then maybe it would be better to render it as one and then scale that?

UICollectionView Stacking

How can I stack cells (in a UICollectionView) on top of each other? Feedly does it quiet well and I was wondering if I can somehow manipulate the zIndex property to get a similar effect in navigation of a UICollectionView.
Or am I wasting my time with UICollectionViews and should be looking into changing my approach with perhaps a Container View Controller?
In order to accomplish this my team added a basic full page horizontal cover flow layout to a uicollectionview. We then added a pan gesture recognizer and disabled scrolling on the collectionView controller. As soon as the pan gesture starts we screen cap the cell and place the image over the collectionView. Once that is done we manually change the page of the collectionView to the next page behind the screenshot. We then animate the uiimage (the screen cap of the previous page) along the path of the gesture. If it goes past a threshold we commit the animation and remove the image and you get the full effect of a previewed collectionView cell.
Unfortunately the threshold checking is a bit tedious because you must revert. Also the animation for bringing a cell back is a little quirky. With this method if you don't add it as a special case then it looks the cell is always behind. Since we want it to look like a stack we made sure that it looks like you are pulling the previous cell from offscreen to the top of the stack. This is done by keeping a collection (NSArray) of cell screenshots that matches are data source so basically we can just grab the image based on indexPath.row. Do the pan gesture recognizer to bring it back on to the stack. If it passes the threshold we commit the animation and at the end change the current cell of the collection view and remove the screenshot. So it feels seamless.
There is really nice write up regarding this, jump onto this website and you will find everything you need.
http://skeuo.com/uicollectionview-custom-layout-tutorial
Basically what you are looking for is the CustomLayout.
You can use CHTCollectionViewWaterfallLayout to create pinterest-like-layout. It's created on top of UICollectionView.

Pan and Pinch a UIImageView within a ScrollView

I have created a small app using a ScrollView w/ paging and a series of UIImageViews each representing a page. It acts similar to the Photos.app.
I want to be able to pan and zoom individually for each image (page of a scrollview).
What would be the most sound approach to do this? Should I replace the UIImageView page with a scrollview with a UIImage inside it? I would then have a main scroll view where each page of the scrollview had a scrollview with an image inside it that could be pinched,etc.
It seems like a messy approach. I am looking for a clean approach. Any suggestions?
Well, as far as I know the approach you suggest is the way it is done. I have used this to create a PDF viewer and once everything is in place it doesn't feel too messy.
You might want to use CATiledLayer as your inner (per-page) scrollview's layer (instead of CALayer) if these images you have are really big (which could well be the case since otherwise zooming in on them would not bring you much but pixelation, but this is just an assumption on my part).
Checkout UIPageViewController. This controller manages a view controllers for each page and transitions between them using effects like page curl or scroll.
In your case you would create a view controller that manages a scrollview for zoom & pan for each page.

Resources