Nested collection view in table view is better or multiple collection view - ios

I have to showcase some image with a little information like title and subtitle which will be horizontally swipeable. Basically, it will be like Airbnb app which shows the category and elements in it with horizontal swipe. The only difference is that in my case number of category(row) is fixed, which is 2. DataSource is same for both rows. I have two approach first is using two CollectionView and second one is by using a TableView and nesting the CollectionView inside tableview cell. Googled and get only the implementation part for both approach not the comparison or use cases for the approach. So my question here is, which process should I follow and why?

1) Using nested Collection view will make the code complex.Generally used only when cannot be implementable using table view.
2) Table view is similar to collection view just that it can be scrollable vertical not horizontal. This make table view easy to implement.
3) In your case collection in table view will work great. Row is fixed in that case you can use static table view.

Related

Creating a menu in iOS

I'm currently creating an update of my iOS application and I'm a bit stuck. I've tried to googling around but cannot find a decent answer on this.
I've a menu which links to different views. And I'm not really sure if I've done it the best method.
I've created a view, and added the links into a stack view. Should I considering changing it all to a tableview? or a collection view? Or maybe there's another way?
The current look:
Should I change this to a tableview? collection view? or something else? Or just let it stay as it is?
If the number of items in your menu changes at runtime and is large, you should use a table view, because a table view is good for efficiently displaying a screen's worth of items from a large list of items.
If the contents of your menu is small (under maybe two screenfuls of items) and fixed at compile time and you are using a storyboard, then you could use a table view with static cells, if you can make it look the way you want.
If the contents of your menu is small, then you can use a stack view (inside a scroll view) if that is easier for you. There is no particular advantage to using a table view over a stack view to display a small amount of content, unless you need other features of the table view (like the ability to select/deselect rows).
Based on the screen shot you posted, I'd either use a table view with static cells (since the screen shot is from a storyboard) or a stack view, depending on whether I can get the appearance I want from a table view. If, as in the screen shot, the buttons must be centered vertically, I'd use a stack view, because it's easier to vertically center the content with a stack view.
Look, the fact of have many itens on your screen is clear on the mobile applications, to make it easy, we have collecions view like UITableView and UICollectionView. On the UITableView's case, this implements the scrolling and have methods do handle the operations' list, you can see the documentation to check these methods: https://developer.apple.com/documentation/uikit/uitableview.
Main reasons to use UITableView
Implements scroll behavior.
Independent of size screen you can access all itens.
Easy to detect interactions like tap on cell.
Easy to make changes, like insert and remove content.
The UITableView exists precisely to solve problems like you has.

How to create a complex scrolling view in iOS similar to yelp?

Yelp has this View show up when you click on a specific restaurant or some event:
In the picture above there is the Cascal label, then Write a Review button, then three buttons (Photo or Video, Check in, Bookmark) all in a row, then a map, and some cells underneath (Directions, Call, Explore the menu, etc.).
How can you make a complex scrolling view similar to this (do you have to use a collection view or table view?)? Since in both a tableview and collectionview you are reusing the same cells again and again (with the same layout) so it is difficult to create a view with so many heterogeneous elements like in the picture above.
Use a table view and a bunch of different cell classes each with their unique design (XIB or Storyboard) and height.
Select the cell class and height depending on index path and let table view delegate methods return accordingly.
Very basic stuff actually.
You only reuse cell classes if you need to. In the Yelp example the Directions, Call, Explore the Menu and More Info cells may have used the same design because the layout seems to be identical, only the image and text differs.

Paging through different diagrams in a table view cell

I'm looking for a method to page or slide through up to 6 different views in one table view cell. What's the best approach to do that?
I already experiment with a Collection View and a Page View Control. But the diagrams are represented by different classes, so that the standard tutorials setting up a label, are not working for me.
Thank for any feedback on this topic.
Based on what you are doing, I would use a UICollectionView with different UICollectionViewCells for your different diagrams. That should allow you to use different classes for the content of each cell.
So first go and create a UICollectionViewCell for each diagram.
Then you are going to want to go into your UICollectionViewController (or wherever you are implementing your collection view) and in the cellForItemAtIndexPath method tell it which cell to display for each indexPath.

Scrolling across UITableviews

I have a situation where I need to scroll across UITableViews. The number of UITableViews could be any number, it is dynamic. In that case which of the following implementation would be better, taking into account the memory intensiveness, UX and overall efficiency ?
To have a scroll view on which I put all the tableviews
To have a collection view on which I put the tableviews on each cell of the collection view.
or any other suggestions are welcome.
Thanks
TableView inside TableView or TableView inside CollectionView will be good approach other wise view reuse functionality has to implement by you.
As you say your data us dynamic
instead of providing scrolling to inner and outer tableview you can populate data in inner tablView they will grow as much data is present and out tableview will contain these inner tableviews and serves as scrollview (provide scrolling/ pagination)
Hope it helps.
If, based on your comments, you want to have multiple table views that you can scroll horizontally between, I would highly recommend creating a page view controller where each table view is a page. If you're unfamiliar with how to create page view controllers, I have a little open-source project that makes it easy to build your own, or alternatively look at my code and replicate it.
https://github.com/mamaral/MAPageViewController

table view with multiple columns

i want to display name phone number and salary of a employee in an ipad in the form of table with multiple columns for that i take three table views and successfully displayed data in them . the table views are scrolling independently.but i want to implement if one table view is scrolled the second and third must be moved parallel. can any one please tell me how to implement that one....
If you want all your UITableViews dependants and scrolling at the same time, there is no reason to create multiple table view.
You can just create un custom UITableViewCell with the layout and style you want! This will be easier and will consume less resources.
find out position of cell in first table depending on that change position of cell in next table.
You can use following property of UITableView - – scrollToRowAtIndexPath:atScrollPosition:animated:

Resources