I am new developer, want to know when to use table view, collection view and scroll view.
I have one grid kind of view in app which shows images fetched from server.
I am new developer, want to know when to use table view, collection view and scroll view.
I have one grid kind of view in app which shows images fetched from server.
Table views can't do a grid at all. They only support a 2 dimensional list of items. It may or may not be divided into sections, but it will always be a simple list, not a grid.
A collection view supports a grid of cells. (It also supports layouts other than simple grids, although that doesn't seem relevant here.) It's made to manage large numbers of cells that can scroll off-screen, and can handle dynamic content, and dynamically loading content. It might be a good fit for your application, or if the grid is static enough you might be able to use a scroll view and create the grid yourself.
I wrote a zoomable tiled image library a while back, and for that, it made more sense to use a generic scroll view and build the tiling myself. Your milage may vary.
From what you describe, it sounds like you want a grid of tiles/cells, and the ability to load and display images into those tiles from a server. I suspect a collection view is a good fit for you, but I would suggest looking at the UICollectionView class reference, along with the UICollectionViewDataSource and UICollectionViewDelegate protocols, and the supporting class UICollectionViewLayout to get a feel for what collection views can do and how you use them.
Tableview is simpler, with just one column of cells. It is also (IMHO) easier to handle programmatically.
CollectionViews are much richer, allowing for several columns, more sophisticated layouts, but more complex to use.
ScrollView is just a view where you put what you want (text, images), not structured cells. Note that TableView and CollectionView are themselves UIScrollView subclasses.
If you fetch several images and want to present in structured way, select Table or Collection.
If your data to display can fit with a simple column, choose TableView.
Otherwise, collectionView may be your friend.