Skip to content

madewulf/ActiveTextView-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActiveTextView

This project consists of a few examples demonstrating how to draw selectable multicolored text in iOS.

Summary

ActiveTextView was developed because drawing multi-colored selectable text on iOS is a pain. The sources offered here won't likely be a perfect drop in solution for developers requiring this functionality, but we feel it demonstrates how to accomplish much of the most desired functionality with respect to multi colored text rendering. ActiveTextView works both ARC and non-ARC build enviroments.

The following image is a simple example of what ActiveTextView can do:

Image

You can specify a string to draw, as well as substrings containing different formatting and color.

Image

In addition to specifying custom formatting so specific regions of your text, you can also specify handlers that will get invoked when the user taps on text within a specific region:

Image

ActiveTextView also demonstrates three different techniques for having the text visually respond to user taps:

  1. The color of the string can be adjusted to indicate that something has been tapped. (Useful for selecting URLs, for example).
  2. The bounding region of the text can be used to draw a rectangle (or any other shape) behind the text statically.
  3. The bounding region of the text can be used to draw a rectangle behind the text, but this rectangle can animate between successive positions through the use of the SlidingTextSelectorView class:

Image

Known Issues

Currently, when highlighting selected regions (either with the SlidingTextSelector, or the static background) ActiveTextView doesn't handle regions that span multiple lines.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published