forked from shinydevelopment/SDHTMLParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.m
More file actions
41 lines (30 loc) · 1.16 KB
/
Copy pathViewController.m
File metadata and controls
41 lines (30 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// ViewController.m
// HTMLtoAttributedString
//
// Created by Greg Spiers on 03/12/2013.
// Copyright (c) 2013 Shiny Development. All rights reserved.
//
#import "ViewController.h"
#import "HTMLParser.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UILabel *label;
@property (strong, nonatomic) IBOutlet UITextView *textView;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *HTMLString = @"<p>Hello world</p><p><b>Bold text</b> <a href='http://google.com'>Google.com</a></p>";
HTMLParser *parser = [[HTMLParser alloc] initWithFontSize:15 fontName:@"Superclarendon-Regular" boldFontName:@"Superclarendon-Bold" italicFontName:@"Superclarendon-Italic" boldItalicFontName:@"Superclarendon-BoldItalic"];
NSAttributedString *attributedString = [parser attributedStringFromHTMLString:HTMLString];
self.label.attributedText = attributedString;
self.textView.attributedText = attributedString;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end