I have hit a slight problem with UICollectionViews. I have posted a question before here but I think I have moved bit -
UICollectionView - Autolayout with pinterest style layout
Objective -
UICollectionview with a custom positional layout with the cells using auto layout.
Current state of play:
I currently have a LayoutView which inherits from UICollectionViewLayout. In my PrepareLayout() I am looping around my collection of items and create a list of attributes which I then return via the LayoutAttributesForElementsInRect depending on the rectangle.
Also during the PrepareLayout I use "prototype" cells (cells that are used only to get the correct size and not part of the UI). I populate the cells with the data and then ask the cell for the minimal height. The width is calculated based on how wide my current item needs to be - i.e. if it spans a number of columns.
Issue:
So my problem that I have hit is that my cells consist of multiple labels that are multiline (0 lines). I have created constraints attached to the ContentView top, left, right and bottom but I can't seem to get the label to wrap correctly. I know that UILabel requires the PreferedMaxWidth to be set but my problem is that my cell is going to have a UIImageView beside the label so I don't think I can calculated the available space that remains.
Could anyone lend a helping hand or point me in the general direction of where to find some more information?
NSString boundingRect with size... is that not sufficient? - DonMag