UICollectionView newspaper like layout

2019-03-09 04:39发布

问题:

Can UICollectionView be flexed to dynamically render interfaces like this one below (Newsify for iPhone)?

Or can only predefined static layouts be rendered? I would want to layout based on the image dimensions (h x w), say small grids for small images and larger ones for big images, all decided at runtime based on the data I get from my datasource.

EDIT: Any good tutorials on complicated dynamic layouts like the one above?

回答1:

Can UICollectionView be flexed to dynamically render interfaces like this one below (Newsify for iPhone)?

Yes.

Any good tutorials on complicated dynamic layouts like the one above?

There are some nice ones in GitHub, like:

  • https://github.com/chiahsien/UICollectionViewWaterfallLayout
  • https://github.com/jayslu/JSPintDemo
  • https://github.com/aceisScope/WaterflowView
  • https://github.com/njdehoog/NHBalancedFlowLayout

And from other places:

  • http://www.binpress.com/app/pinterest-gridview-for-ios-masonryview/836

Raywenderlich as also a serie of posts related to that:

  • http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
  • http://www.raywenderlich.com/22417/beginning-uicollectionview-in-ios-6-part-22