I downloaded an iOS waterfall Stream Image Display source code from the Internet. With the help of Web experience, I already have a float: Left effect for iOS similar to CSS style, and then formed a waterfall stream effect, or you can use HTML to split a table into several columns in a row and then fill in the content.
The download of the waterfall stream demo is as follows:
1. it is always necessary to know the number of records first, which can be read from JSON or XML (it is best to display the image height and width in JSON or XML, for later use ).
2. If you want to create three columns, you can use three uitableviews, with the average width and dynamic height. The page height is the highest in uitableview.
3. tags are used when three uitableviews are initialized (I increasingly think that tags are very useful in iOS, just like the IDs in HTML controls read in JS), and showsverticalscrollindicator and scrollenabled are set to No, set separatorstyle to uitableviewcellseparatorstylenone and add it to uiview.
4.
-(Nsinteger) tableview :( uitableview *) Tableview numberofrowsinsection :( nsinteger) Section {ReturnWhen the number of rows of records/Column ;}
-(Cgfloat) tableview :( uitableview *) tableview heightforrowatindexpath :( nsindexpath *) Indexpath {IntArrindex = Current indexpath. row * column (3) + Current indexpath. Column; |Return[[XML/JSON objectatindex: arrindex] objectforkey:@"Height"];}
-(Uitableviewcell *) tableview :( uitableview *) tableview cellforrowatindexpath :( nsindexpath *) Indexpath {//Obtain the data corresponding to the current array from the data source, and then fill it with uitableviewcell.}
Thanks to the source code Author: http://code4app.com/codesample/4fdfecd96803fa117f000000