How to create a view which contain image and text as like newspaper has?

人盡茶涼 提交于 2019-12-25 20:08:11

问题


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:

  1. Create a layout with UIIImageViews and UITextView
  2. Use HTML and UIWebView
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!