DWCoreTextLabel

It is a Label based on coreText,help you to layout of the collocation of illustration and character.基于coreText的Label控件,帮助你做图文混排。


License
MIT
Install
pod try DWCoreTextLabel

Documentation

DWCoreTextLabel

DWCoreTextLabel

Description

This is an object which is based on CoreText and a subclass of UIView.It provides all dayly function of UILabel,and also enable collocation of illustration and character、click-action and other extense function at the same time.

描述

这是一个基于CoreText、继承自UIView的控件。它是一个可以满足UILabel所有日常功能并提供图文混排、点击事件等扩展功能的控件。

Func

  • Insert image into a piece of text.
  • Draw image with text cover or around it.
  • Select a piece of text an copy it to pasteboard.
  • Add action to a piece of text or image.

功能

  • 向一段文本中插入图片。
  • 绘制图片并在其上绘制文字或者环绕着图片绘制文字。
  • 选中一段文字并复制到剪贴板。
  • 为一段文字或图片添加点击事件。

Usage

Firstly,drag it into your project or use cocoapods.

pod 'DWCoreTextLabel'

Then,to make you use it easily,I keep all the property the same as UILabel.So,use it as UILabel and other extense function you may understand its meaning by name.

And here are some API about image:

To insert image by using the series API of dw_InsertImage...

To draw image by using the series API of dw_DrawImage...

To add click-action by using dw_AddTarget...

To delete image by using dw_RemoveImageByID...

如何使用

首先,你应该将所需文件拖入工程中,或者你也可以用Cocoapods去集成他。

pod 'DWCoreTextLabel'

为了让开发者能够更快上手,我保留了与UILabel相同的属性名。所以你可以像使用UILabel一样使用它,并且一些拓展属性也是见名知意的,看他的属性名你大概就该知道他的用途。

还有一些图片相关的API:

使用dw_InsertImage...系列API向文字中插入图片。

使用dw_DrawImage...系列API在文字间绘制图片。

使用dw_AddTarget...API为文字或图片添加点击事件。

使用dw_RemoveImageByID...API为删除已经插入或绘制的图片。

Contact With Me

You may issue me on my Github or send me a email at codeWicky@163.com to tell me some advices or the bug,I will be so appreciated.

If you like it please give me a star.

联系作者

你可以通过在我的Github上给我留言或者给我发送电子邮件codeWicky@163.com来给我提一些建议或者指出我的bug,我将不胜感激。

如果你喜欢这个小东西,记得给我一个star吧,么么哒~

Other

If you want to learn something about CoreText,you may come to my Blog.

老司机的简书

其他

如果你想学习一些CoreText的相关知识,你可以来老司机的博客

老司机的简书