来自 UITextView 或 UILabel Swift 图像的自定义项目符号 [英] Custom Bullets from Images on UITextView or UILabel Swift

查看:28
本文介绍了来自 UITextView 或 UILabel Swift 图像的自定义项目符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基本上是大型网站的移动版本的应用.该网站有一个特定区域列出产品功能.每个功能都带有一个独特的自定义图像.

I'm creating an app that basically is a mobile version of a large website. This website has a certain area that lists product features. Each feature is bulleted with a unique custom image.

有没有办法快速做到这一点?本质上,创建一个字符串项目符号列表,而不是使用小图像作为项目符号点?

Is there a way to do this with swift? Essentially, create a bullet list of strings, but instead use small images for the bullet dots?

推荐答案

  • 将 UITextView 的文本类型设为属性

    • Make your UITextView's text type as attributed

      增加头部缩进值

      按以下格式构造字符串:

      Construct your string in the following format:

      "• 这是一个字符串\n\n• 这是另一个字符串,但更长更好.这个字符串中的字数可能比上一个多."

      "• This is a string\n\n• This is another string, but longer and better. The number of words in this string are probably higher than the last one."

      使用 Alt + 8 输入项目符号.

      Use Alt + 8 to type in a bullet.

      结果:

      这篇关于来自 UITextView 或 UILabel Swift 图像的自定义项目符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆