Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 1.88 KB

README.md

File metadata and controls

56 lines (37 loc) · 1.88 KB

R87AttributedString

Version License Platform

Introduction

With the help of R87AttributedString you can format attributed texts easily.

For example you can add the thext #like this# or like this and you can specify from code how the text inside the # and * characters should look like.

Screenshot

Installation

R87AttributedString is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'R87AttributedString'

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

You can use the librarly like this:

NSString *textString = @"*CocoaPods Events*\n\n#Code of Conduct#\nAll attendees, speakers, sponsors and volunteers...";
NSDictionary *defaultTextAttributes = @{
	NSForegroundColorAttributeName: [UIColor blackColor],
	NSFontAttributeName: [UIFont systemFontOfSize:14.0],
};
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:textString attributes:defaultTextAttributes];

[text r87_addAttributes:@{
	NSFontAttributeName: [UIFont boldSystemFontOfSize:24.0],
} betweenCharacters:@"#"];

[text r87_addAttributes:@{
	NSForegroundColorAttributeName: [UIColor redColor],
	NSFontAttributeName: [UIFont systemFontOfSize:35.0],
} betweenCharacters:@"*"];

self.textView.attributedText = text;

Compatibility

iOS 4.3+

License

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