问题
I want to create a view which contains image and text, like a newspaper has.
For example, in 320 pixel width, a 200 x 100 image. The image is on the left side of the view, and the remaining space on the right side and bottom will contain text.
回答1:
You arrange UIImageViews and UITextViews in the way you want them by setting their frames. Then assign images to the imageViews and text to the textViews.
回答2:
Well you can 3 options:
- Create a layout with UIIImageViews and UITextView
- Use HTML and UIWebView
- NSAttributedString and draw it on a view with CoreText
回答3:
That's almost certainly laid out in an UIWebView, with the styling on the image set to "float: left" with margin settings that hold the text off from the edge of it but let it wrap around it.
Here's a little tutorial about it: http://www.tizag.com/cssT/float.php
Note that this is about the HTML and CSS content to feed the UIWebView, not anything iOS-ish.
来源:https://stackoverflow.com/questions/7888749/how-to-create-a-view-which-contain-image-and-text-as-like-newspaper-has