Hyder
Hyder

Reputation: 1173

How to make a grid layout in iOS?

I want to make a kind of grid layout (not scrollable) in an iOS app, similar to this:

enter image description here

I can do it using multiple UIView but that won't be a good solution. If I use `UICollectionView', I believe it will become scrollable? I want fixed grid items, which resize them according to screen size.

Any guidelines please?

Thanks!

Upvotes: 0

Views: 1139

Answers (2)

trapper
trapper

Reputation: 12003

If you just want fixed 3x2 layout scaling to any screen size then multiple UIView is a good solution for this and exactly what you should do.

Also make a RestaurantView UIView subclass to configure and display the image/rating/title/description/etc details for each restaurant.

-

If you want the number of restaurants to change depending on screensize then use a UICollectionView with ResturantCollectionViewCell instead.

Upvotes: 0

Ketan Parmar
Ketan Parmar

Reputation: 27448

You should use collection view with scrolling and bouncing disable.

It is all about your collectionview's flowlayout's item size.

You have to calculate item size receptively your screen's size.

And you can set that item size to flowlayout and can use that flowlayout with your collection view.

For example, You can refer this so post.

Upvotes: 2

Related Questions