Skip to content

bgayman/CircularTextView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

CircularTextView

UIView subclass that displays an NSAttributedString in a circle based on the bounds and inset of the view. Based on this.

Some improvements include handling of emoji, multiple font families and sizes as well as many NSAttributedString attributes.

Should work on swift 3.0 Xcode beta 6.

Example

let circularTextView = CircularTextView(frame: CGRect(x: 0.0, y: 0.0, width: 320.0, height: 320.0))
circularTextView.inset = -15.0
circularTextView.backgroundColor = UIColor.white
let font = UIFont(name: "Avenir-Black", size: 30.0)!
let attribString = NSMutableAttributedString(string: "The quick brown fox jumped over the lazy dog. 🐺  🐶", attributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: UIColor.darkText, NSKernAttributeName: 1.25])

//Then style your NSAttributedString as you like... 

circularTextView.attributedText = attribString

Which could result in something like:

screen shot

Todos

  • Clean up code
  • Improve underline and strike through particularly dotted underline
  • Support more attributes

About

UIView that displays an NSAttributedString in a circle based on the bounds and inset of the view

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages