MXMarkdownLabel-in-Objective-C
MXMarkdownLabel
is a basic Markdown syntax supported label for iOS..
Installation with CocoaPods
pod 'MXMarkdownLabel'
Usage
#import "MXMarkdownLabel.h"
@interface ViewController () <MXMarkdownLabelDelegate>
@end
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
MXMarkdownLabel *mdLabel = [[MXMarkdownLabel alloc] initWithFrame:[[self view] bounds]];
[mdLabel setTextColor:[UIColor purpleColor]];
[mdLabel setCustomLinkPattern:@"(?<=:\\s?)Elias"];
[mdLabel setDelegate:self];
[mdLabel setText:@" Normal Text\n **Strong**\n _Italic_\n __Underlining__\n ~~StrikeThrough~~\n `InlineCode`\n 82183021\n +86 131-1111-1111\n http://www.baidu.com\n [f#E64E64ForegroundColor]\n [B#E64E64BackgroundColor]\n [f#ffffffb#000000Colorful]\n Author: Elias"];
[[self view] addSubview:mdLabel];
}
- (void)markdownLabel:(MXMarkdownLabel *)label didSelectLink:(NSString *)link {
NSLog(@"link: %@", link);
}