Hi i would to implement a very long scroll view for a forum-like view, designing something similar to this image
would it possible to implement this with a table view (considering the not very defined borders between cells and some views overlapping other cells) or i should write a long scroll view with many subviews (memory management?)? Thanks
Use UITableView
, and it would be better if you subclass UITableViewCell
and use the layoutSubviews
method to adjust the subviews when you adjust the size of the cell. Change the cell size according to the content present in it.
Check the below links for this:
One piece of advise : be lazy !
if you want to present a lot of views in a scrollView, don't load them all. The best practice for this is to use a UITableView
. If you know the height of each cell before drawing them on screen, you can implement this method
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
in your Tableview Datasource. If you want to use a UIScrollView, add your subviews on demand when the user scroll. The best approach is to implement the delegate method :
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With