How to create a view like Photo Library view in iOS ? Like this
4 columns each row
Can scroll up/down
Can touch up to choose an image
I would suggest implementing a CollectionView and it's what Apple recommended in the WWDC videos.
The number columns can be achieving by the cell size & spacing. Do you also want only 4 columns in landscape mode and on iPad display or should it display more columns?
Scrolling is supported in collection views which there are too many images to display on screen.
Image (cell) selection is also supported by collection views.
There are plenty of good tutorials for collection views but look for the more recent ones (in the last year or two) which give examples using storyboards.
Hope this helps.
Related
I am using Swift 3. I am currently using a UITableView to display a list of items - specifically a list of athlete results from a race and it has about 10 columns (e.g swim time, bike time, run time, place). I am currently using a UITableView and it works OK, but I am finding it difficult/not possible to do what I want. I found a few other solutions out here that are similar but they are using HTML/Web front ends vs swift 3 / native iOS.
I would like fixed width columns, and column headers. I want to be able to scroll left and right and up and down. I want the far left column to be fixed. This is the column with the athlete name. I want all the other columns to scroll left and right while this remains fixed.
I use an app called PowerSchool for my kids' school that illustrates the concept perfectly. Attached are two screen shots with names and grades brushed out.
Scroll View One
Scroll View Two
I am thinking that UITableView will not do this and I need to use UICollectionView or something else.
Any info to help me get started on this would be greatly appreciated. I plan to make this work on iPad and iPhone in both portrait and landscape.
Hi for this you need to two components.
Either a UIScrollView with a UITableView
or UITableViewCell inside a UICollectionView
or a UICollectionView inside a UICollectionView
This can be achieved by mixing two components or you can use some sort of library:
https://github.com/fullc0de/HKKScrollableGridView
https://github.com/kanaishinichi/TAXHeaderSheet
My requirement is basically listing some details of an employee.
So, it is a list of 100s of employees.
The app is an iPad landscape application. The screen will look somewhat as follows.
I was thinking of a UITableView with a custom cell, that contain labels horizontally arranged on it as per my client's requirement.
But on considering the multitasking in iOS 9, I now face an issue in using this as I will not be able to maintain the same layout if the view reduce to 1/3rd or 1/2.
Now the best option I can think of is to use a UICollectionView with the labels shown as rows. That is something as follows:
I would like to get your suggestions on this and the best practises to be considered on designing a similar layout.
I'm working on an app that includes the names of users with their icons under an image. I'm currently using collection view in order to distribute the names. I'm using this approach since each cell when clicked will be holding the user object. However, I'm having some layout issues when it's used (please check attached image). The spacing is unusual. The desired output is the cells having a certain spacing limit between them and if any cell cannot fit, will be placed on the other line. I tried using the delegate methods for spacing by setting it to 5 however it's not working (the cell's size will be dynamic). Should I subclass and create my own Collection view Layout ? if there is any other approach without using collection views please let me know. Thank you.
I have 10 images and their description. I have to display it in UITableView. I want to display
those images in tile view. I am using this library. Here in the sample snap these 5 images are displaying in 2 cells. But i want that, all those images will display in just 1 cell. How can I do that?
Please Help
UICollectionView is the way to go.
UICollectionView takes the familiar patterns of UITableView and generalizes them to make any layout possible. In your case it will be fairy simple. You will use a standard built-in flow layout to place the tiles with pictures.
I have an iPad app which always stays in landscape mode. It is more of a data centered app with 5 columns and couple of hundreds of rows.
In current implementation, I have used UITableView. The rows' height could be anything depending on the data that comes in from server and all the columns can have different size.
The question is, can I use UICollectionView instead of UITableView? Will there be any performance issues? If yes, which is better in grid like layout? I understand UICollectionView is to be used in iOS pictures app like layout but how it behaves for grid like layout?
Thanks,
Pruthvid
What you describe is exactly what UICollectionView is designed for, it's the perfect solution. The limitation is only to the version of iOS you will be able to support (if you need to go back that far).
The choice really comes down to the visuals you want. Of you want each row to have a height defined by the maximum height of any column value in that row and the row appears as a single row item and the last row of the table should be full width then you may prefer to use a table view.
The collection view gives you more options for accessory views (as opposed to just the headers and footers of the table view).