I have some problems getting heights
of my cells
because I have dynamic height
images
inside them and while using some async
methods (AFNetworking
) it still looks bad when cells
dynamically change because UITableView
offset
is constantly changing.
While looking in facebook
, 9gag
or some other apps I saw that they have set their post
(cell
) height
before image
is loaded (so with some placeholder) but that height
perfectly fits image
that comes in so I was wondering hows that possible (since if theres no image you cant tell its height yet).
Would it be a good approach to determine image
height
on server
and send that to iOS app along with imageURL
, title
and other stuff I have in cell
and then determine cell
height
based on that?
Or any other ideas?
Thanks.
The image they are loading probably comes from an rss or html feed where they list the width and height of the image in the html.
http://www.w3schools.com/tags/att_img_width.asp
If you can parse something like this or have your server return the height and width from a database table then you should be able to generate a placeholder image.