• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created almost 12 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

takes in an NSString or NSAttributedString and creates a CGPathRef for that string

A category for UIBezierPath that add methods which will create a path for a specified NSAttributedString. For use with iOS 6 and later.

Installing the project

pod 'ARCGPathFromString'

Creating a path from an NSString

You can create paths for single line NSStrings by specifying the font to use.

+ (UIBezierPath *)pathForString:(NSString *)string withFont:(UIFont *)font

The multi line method also requires the text alignment (can be left, right, center, or justified) and a maximum width for each line of text.

+ (UIBezierPath *)pathForMultilineString:(NSString *)string withFont:(UIFont *)font maxWidth:(CGFloat)maxWidth textAlignment:(NSTextAlignment)alignment

Creating a path from an NSAttributedString

You can also create paths for single line NSAttributedStrings

+ (UIBezierPath *)pathForAttributedString:(NSAttributedString *)string

The multi line method also requires a maximum width for each line of text.

+ (UIBezierPath *)pathForMultilineAttributedString:(NSAttributedString *)string maxWidth:(CGFloat)maxWidth

License

ARCGPathFromString is available under the MIT license. See the LICENSE file for more info.