iphone:图像周围的文字
是否可以在图像周围添加文字?就像图中一样? 替代文本 http://andyj.be/image.png
Is it possible to have text go around an image ? like in the picture?
alt text http://andyj.be/image.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也将使用 UIWebView。您也许可以通过上下滚动页面来猜测他们在做什么。根据我的经验,与 UIScrollView 相比,UIWebView 滚动得更慢,并且停止得更快。
如果您确实想使用 UIScrollView 来实现此效果,则可以使用以下方法:
获取文本并将其放入循环中。在循环的每次迭代中,从末尾删除一个单词。将上述方法中的
size
与您想要的帧大小进行比较,如果更高,则再次执行循环。当size.height
小于您想要的值时,您知道要添加到顶部文本视图(图像右侧)的文本量。将其余文本添加到图像下方的文本视图中,使用上述方法调整其框架大小。I'm going to go with UIWebView as well. You can probably make a guess as to what they're doing by scrolling the page up and down. In my experience, a UIWebView scrolls more sluggishly compared to a UIScrollView, and comes to a stop more quickly.
If you really have your heart set on using a UIScrollView to make this effect, you can use this method:
Get your text and put it in a loop. With each iteration of the loop, chop a word off the end. Compare the
size
from the method above to the frame size you want and if it's taller, go through the loop again. When thesize.height
is smaller than what you want, you know how much text to add into the top text view (to the right of the image). Add the rest of the text into the text view under the image, using the above method to size it's frame.我愿意打赌你的屏幕截图中的视图是 UIWebView。如果您愿意使用 UIWebView,那么您一定可以!否则,我不知道有任何内置控件可以轻松完成此操作。
I'd be willing to bet that the view in your screenshot is a UIWebView. If you're willing to use UIWebView, then sure you can! Otherwise, I'm not aware of any built-in control that'll allow this to be done easily.