Suggestion on using UICollectionView - ios

I have a set of pictures organized by name like below which indicates where a photo should be in the view:
Image_PPRRCC.png
PP: Page No. of photo
RR: Row of photo
CC: Column of photo
The app has three kind of views as below.
1- View the whole page. Scroll horizontally to view next page.
2- Single image view. When user has double tapped on a picture in whole page view. Scroll horizontally to next photo.
3- View a row of photos. When device is in landscape mode. Scroll vertically to view next row and scroll horizontally to view next page.
I tried using a UICollectionViewController and put the images in dynamically sized cells sorted by their names. The problem was with horizontal scrolling. When horizontal scrolling is selected the items are populated vertically in a UICollectionView and the sorted array of image names and position of each photo in row and column of a page is messed up.
Then tried to use a UIPageViewController with a UIView for each page with a UICollectionView in each page to show images of corresponding page. But I couldn't manage to setup the views for it.
So any suggestions how to setup the views? Which method is better for the desired interface of the app? The one UICollectionViewController method or UIPageViewController method? Or maybe a better method?

use #property (nonatomic) UICollectionViewScrollDirection scrollDirection;
The grid layout scrolls along one axis only, either horizontally or vertically. For the non scrolling axis, the width of the collection view in that dimension serves as starting width of the content.
read more about UICollectionViewFlowLayout in https://developer.apple.com/library/ios/documentation/uikit/reference/UICollectionViewFlowLayout_class/Reference/Reference.html#//apple_ref/doc/uid/TP40012182-CH1-DontLinkElementID_4

Related

Syncing Two CollectionViews For Navigation

I’m trying to sync two collection views proportionally for navigation. One of the collection views is menu-like and is at the top, and the second is a larger one below. What I would like is for the top collection view to scroll a distance of the width of one cell (the cells are dynamically sized) when the user scrolls the bottom collection view a distance of the main screen’s width. The closest thing I've seen to this effect would be iOS: Custom top segmented control works as expected only when using debugger. What I would like to change is to have the left most cell in the top menu always selected. In addition, when the user scrolls the bottom collection view the width of the screen, a new cell should Replace the left-most cell in the upper menu and be selected. Any help in Swift would be especially appreciated, but ObjC answers are also welcome.

UICollectionView scroll whole page

I have a viewController with some text and under it a UICollectionView (about 50% of the page).
My problem is that when I scroll on the collectionView just the cells are being scrolled and not the whole page (the text + the collection cells).
You can think about it like on Instagram profile page (half info half collectionView), when you scroll on Instagram everything is being scrolled and not just the collection cells.
Anyone knows how can I do it?
Thanks!
Add the text content as separate cells on top of the UICollectionView.
Preferably, create a different section which would contain the cells with the top text.
Keep the backgroundColor/backgroundImage of these cells plain to give the effect that they are simply added as UILabels on a form. Doing so will also differentiate from the rest of the actual UICollectionViewCells.
Now, when you scroll the UICollectionView. It will give an effect that the text along with the cells are scrolled.
In Attribute inspector > Scroll View > check Paging enable
Thats because your text/UILabels doesn't belong within the UIScrollView of your UICollectionView, thus it will not be scrolled when the collectionView is. You could create a UICollectionViewCell for your text, include it within your collectionview and expand the collectionView to fit the screen or use a UICollectionViewController

Vertical View Pager either in Swift or in Objective C

Is it possible to implement Vertical ViewPager or not?
if Yes the please suggest me how to do it.
I am working on an app, which is similar to Quiz App.
I want to implement Quiz App result screen in which I am looking to implement Vertical View pager.
Thank you
Abhishek
So that's simply a scroll view, or a subclass of (I.e. A table or collection view). The scroll direction is controlled by the content size (or the layout for the collection). Any scroll view can have paging enabled.
If using a table or collection you simply need to set the row height or item size to the size of the view. For a plain scroll view you add the page views as sub views and set their size to equal the scroll view frame.

How to UITableView & UICollectionView link vertical scroll and UICollectionView & anotherView link horizontal scroll, like a SpreadSheet iOS

I have a problem with the creation of the layout shown in the picture.
Does anyone know how can I create it.
I want to link left tableview's (only vertical scroll enabled) horizontal scrolling with collection's view horizontal scrolling, and create scale view (only horizontal scroll enabled) horizontal scroll linked with collectionView horizontal scroll.
I know it is a bit chaotic, but I think that diagram best represents my problem.
I would also like to load collectionview's data in real time while scrolling.
At the end I will add that I am using the storyboard in my app.
Link to my schema picture

Working with two UITables in a view: how to auto scroll one when the other is scrolled by the user?

So this is the situation:
I will have 2 differente UITables in the same controller. So, i want to work with a classic vertical UITable controlled by the user who scrolls up and down as demanded. Meanwhile, in the same view I want to have a second UITable with horizontal layout.
Is it possible to auto scroll the horizontal table at the same time when the user scrolls with his finger the vertical UITable?
UITableView extends UIScrollView. Implement the appropriate scroll view delegate methods to be notified of changes to the content offset of the table view. Based on the updated value of the table you can update the content offset of the other table.

Resources