views:

20

answers:

2

In some news applications when it loads it shows a list of articles. When we click on an article, it goes to its detailed page. In the detailed page 1st there will be only the text related to the article. But suddenly an image comes(related to the article) on the top left corner and the text re-aligns itself to contain the image.

Wht are they doing here? Are they still using UILabel? If i am just adding a UIImageView inside a UILabel, the text will be be adjusted even before the image appears.How can I replicate this myself?

A: 

I might be wrong, but i think what they are doing probably similar to the following steps:

  1. User clicks on Article
  2. Article description is being loaded, async download of image is being initiated
  3. once the article description is downloaded the detailsview gets added on top of the navigationstack and appears.
  4. user reads the text....
  5. at some point the download of the image finishes, the viewcontroller gets notified in some way and does a re-layout of the detailsview.

the re-layouting (or however you want to call it) will do two things (probably in an animated fashion) As I'm not aware how to wrap text around images within a UILabel (keen to get ahold of that knowlegde tough) I would suggest, that what they do is simply creating a second label with the Imageview in place and then fading the first one (text only) out while fading the second one (containing text and image) at the same time..

not sure if this helps you, but I hope so.
cheers TGiF sam

samsam
A: 

Use UIWebView, the readjustment you are talking about is html basic property, download your content in html format or make a html file programmatic once you download text and image and show them in UIWebView.

Sanniv