In HTML, with CSS, one can do “float” for images, just like this

the image is surrounded by text.
How can I do it WITHOUT UIWebView?
I can’t use UIWebview, because
-
UIWebView has a slight lag after you loadHTML. Its content doesn’t show immediately, not like UILabel or UIImage
-
The image is async loaded, so I need a white space holder there with UIActivityView spinning
Is that possible I just use a UIImageView & UILabel to do float?
Thanks
The “easy” way is probably to use two labels and an image. If your text/images are static, then you can split the text at the right place beforehand. If not, you’ll have to do some text size measurements; see UIStringDrawing.h. Figuring out where all the line breaks should be is non-trivial.
The “hard” way is to create your own subclass of UIView with
textandimageproperties and have it do all the string/image layout and drawing. It’s not actually that much harder than figuring out where the line breaks should be dynamically.The “harder” way is to use Core Text (iOS 3.2+); the Columnar Layout example in the Core Text Programming Guide should work, but also note that
CTFramesetterCreateFrame()can take an arbitrary CGPath, so you can just pass it a path of the available area. This might actually be slightly easier than using UIKit string-sizing and trying to find out where all the line breaks are (you just need to write a lot of Core Text boilerplate instead).