├── Preview1.png
├── LTTextViewApp
├── LTTextViewApp.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
├── LTTextViewApp
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── AppDelegate.m
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ └── ViewController.m
└── LTTextViewAppTests
│ ├── Info.plist
│ └── LTTextViewAppTests.m
├── .gitignore
├── README.md
├── LTTextView
├── LTLinkTextView.h
└── LTLinkTextView.m
└── LICENSE
/Preview1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EugeneZZI/LTTextView/HEAD/Preview1.png
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // LTTextViewApp
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // LTTextViewApp
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // LTTextViewApp
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // LTTextViewApp
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | return YES;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | #Pods/
27 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewAppTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LTTextView
2 |
3 | You need to create text with several buttons in it? You can use UIWebView, UIlabels with UIButtons, another ways. But when you have localizations for 10 or more languages and UI designer wants to have each button with few words on one line - task becomes "pain in ass". You can write your own code to manage this task or simply use LTTextView.
4 |
5 | 
6 |
7 | ## Usage
8 |
9 | Add LTTextView to your project and use this view to display text with interactive buttons. You can customize whole text or/and each button text appearance using NSAttributedString attributes. You should implement LTLinkTextViewDelegate method to get callback from the text view.
10 |
11 | ## License
12 |
13 | This code is distributed under the terms and conditions of the [MIT license](LICENSE).
--------------------------------------------------------------------------------
/LTTextView/LTLinkTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LTLinkTextView.h
3 | //
4 | //
5 | // Created by Eugene Zozulya on 3/29/15.
6 | // Copyright (c) 2015 Eugene Zozulya. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | UIKIT_EXTERN NSString *const LTTextStringParameterKey; // key for title NSString
12 |
13 | @class LTLinkTextView;
14 |
15 | @protocol LTLinkTextViewDelegate
16 |
17 | @optional
18 | - (void)linkTextView:(LTLinkTextView*)termsTextView didSelectButtonWithIndex:(NSUInteger)buttonIndex title:(NSString*)title;
19 |
20 | @end
21 |
22 | @interface LTLinkTextView : UIView
23 |
24 | @property (nonatomic, weak) id delegate;
25 |
26 | - (void)setStringAttributes:(NSDictionary*)textInfo withButtonsStringsAttributes:(NSArray*)buttonsStringsInfo; // buttonsStringsInfo array of dictionaries
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewAppTests/LTTextViewAppTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LTTextViewAppTests.m
3 | // LTTextViewAppTests
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LTTextViewAppTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation LTTextViewAppTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Eugene
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // LTTextViewApp
4 | //
5 | // Created by ZZI on 29/05/15.
6 | // Copyright (c) 2015 ZZICo. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "LTLinkTextView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @property (weak, nonatomic) IBOutlet LTLinkTextView *firstLTView;
15 | @property (weak, nonatomic) IBOutlet LTLinkTextView *secondLTView;
16 | @property (weak, nonatomic) IBOutlet LTLinkTextView *thirdLTView;
17 | @property (weak, nonatomic) IBOutlet LTLinkTextView *fourthLTView;
18 | @property (weak, nonatomic) IBOutlet LTLinkTextView *fifthLTView;
19 | @property (weak, nonatomic) IBOutlet LTLinkTextView *sixthLTView;
20 |
21 | @property (weak, nonatomic) IBOutlet UILabel *messageLabel;
22 |
23 | @end
24 |
25 | @implementation ViewController
26 |
27 | - (void)viewDidLoad {
28 | [super viewDidLoad];
29 |
30 | #pragma clang diagnostic push
31 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
32 | dispatch_apply(6, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) {
33 | NSString *selectorStr = [NSString stringWithFormat:@"setupLTView%d", (int)++i];
34 | dispatch_async(dispatch_get_main_queue(), ^{
35 | [self performSelector:NSSelectorFromString(selectorStr)];
36 | });
37 | });
38 | #pragma clang diagnostic pop
39 |
40 | [self setupLTView4];
41 | }
42 |
43 | - (void)setupLTView1 {
44 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
45 | [paragraphStyle setLineSpacing:6.0];
46 | [paragraphStyle setAlignment:NSTextAlignmentLeft];
47 |
48 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.", @""),
49 | NSFontAttributeName : [UIFont systemFontOfSize:12.0]};
50 |
51 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"ligula eget dolor", @""),
52 | NSForegroundColorAttributeName : [UIColor blueColor]}
53 | ];
54 |
55 | [self.firstLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
56 | self.firstLTView.delegate = self;
57 | self.firstLTView.tag = 1;
58 | }
59 |
60 | - (void)setupLTView2 {
61 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
62 | paragraphStyle.alignment = NSTextAlignmentCenter;
63 |
64 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.", @""),
65 | NSParagraphStyleAttributeName : paragraphStyle,
66 | NSFontAttributeName : [UIFont fontWithName:@"HoeflerText-Regular" size:12]};
67 |
68 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"Cum sociis", @""),
69 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)},
70 | @{LTTextStringParameterKey : NSLocalizedString(@"nascetur ridiculus", @""),
71 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)}
72 | ];
73 |
74 | [self.secondLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
75 | self.secondLTView.delegate = self;
76 | self.secondLTView.tag = 2;
77 | }
78 |
79 | - (void)setupLTView3 {
80 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
81 | paragraphStyle.alignment = NSTextAlignmentRight;
82 |
83 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.", @""),
84 | NSParagraphStyleAttributeName : paragraphStyle,
85 | NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:12]};
86 |
87 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"Nulla consequat", @""),
88 | NSForegroundColorAttributeName : [UIColor redColor],
89 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternDot)},
90 | @{LTTextStringParameterKey : NSLocalizedString(@"Donec pede", @""),
91 | NSForegroundColorAttributeName : [UIColor redColor],
92 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternDash)},
93 | @{LTTextStringParameterKey : NSLocalizedString(@"vulputate eget", @""),
94 | NSForegroundColorAttributeName : [UIColor redColor],
95 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternDashDot)}
96 | ];
97 |
98 | [self.thirdLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
99 | self.thirdLTView.delegate = self;
100 | self.thirdLTView.tag = 3;
101 | }
102 |
103 | - (void)setupLTView4 {
104 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
105 | paragraphStyle.alignment = NSTextAlignmentCenter;
106 |
107 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.", @""),
108 | NSParagraphStyleAttributeName : paragraphStyle};
109 |
110 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"rhoncus ut", @""),
111 | NSForegroundColorAttributeName : [UIColor blueColor],
112 | NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:10]},
113 | @{LTTextStringParameterKey : NSLocalizedString(@"Nullam dictum", @""),
114 | NSForegroundColorAttributeName : [UIColor grayColor],
115 | NSFontAttributeName : [UIFont fontWithName:@"HoeflerText-Regular" size:15]}
116 | ];
117 |
118 | [self.fourthLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
119 | self.fourthLTView.delegate = self;
120 | self.fourthLTView.tag = 4;
121 | }
122 |
123 | - (void)setupLTView5 {
124 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
125 | paragraphStyle.alignment = NSTextAlignmentCenter;
126 |
127 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.", @""),
128 | NSParagraphStyleAttributeName : paragraphStyle};
129 |
130 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"Cras dapibus.", @""),
131 | NSUnderlineColorAttributeName : [UIColor blueColor],
132 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)},
133 | @{LTTextStringParameterKey : NSLocalizedString(@"Aenean vulputate", @""),
134 | NSUnderlineColorAttributeName : [UIColor redColor],
135 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)}
136 | ];
137 |
138 | [self.fifthLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
139 | self.fifthLTView.delegate = self;
140 | self.fifthLTView.tag = 5;
141 | }
142 |
143 | - (void)setupLTView6 {
144 | NSDictionary *textAttributes = @{LTTextStringParameterKey : NSLocalizedString(@"By signing you are agreeing to the Terms and Conditions and Privacy Policy", @""),
145 | NSFontAttributeName : [UIFont systemFontOfSize:12],
146 | NSForegroundColorAttributeName : [UIColor grayColor]};
147 |
148 | NSArray *buttonsAttributes = @[@{LTTextStringParameterKey : NSLocalizedString(@"Terms and Conditions", @""),
149 | NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
150 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)},
151 | @{LTTextStringParameterKey : NSLocalizedString(@"Privacy Policy", @""),
152 | NSFontAttributeName : [UIFont boldSystemFontOfSize:12],
153 | NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle)}
154 | ];
155 |
156 | [self.sixthLTView setStringAttributes:textAttributes withButtonsStringsAttributes:buttonsAttributes];
157 | self.sixthLTView.delegate = self;
158 | self.sixthLTView.tag = 6;
159 | }
160 |
161 |
162 | #pragma mark - LTLinkTextViewDelegate
163 |
164 | - (void)linkTextView:(LTLinkTextView*)termsTextView didSelectButtonWithIndex:(NSUInteger)buttonIndex title:(NSString*)title {
165 | NSString *messageStr = [NSString stringWithFormat:@"TextView: %d pushed button index: %d button text: \"%@\"", (int)termsTextView.tag, (int)buttonIndex, title];
166 | self.messageLabel.text = messageStr;
167 | }
168 |
169 | @end
170 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/LTTextView/LTLinkTextView.m:
--------------------------------------------------------------------------------
1 | //
2 | // LTLinkTextView.m
3 | //
4 | //
5 | // Created by Eugene Zozulya on 3/29/15.
6 | // Copyright (c) 2015 Eugene Zozulya. All rights reserved.
7 | //
8 |
9 | #import "LTLinkTextView.h"
10 | #import
11 |
12 | NSString *const LTTextStringParameterKey = @"_LTTextStringParameterKey";
13 |
14 | @interface LTButtonString : NSObject
15 |
16 | @property (nonatomic, copy) NSString *text;
17 | @property (nonatomic, readonly, strong) NSMutableArray *frames;
18 | @property (nonatomic, assign) NSRange range;
19 |
20 | @end
21 |
22 | @interface LTLinkTextView() {
23 | CGSize _oldSize;
24 | NSString *_currentString;
25 | NSDictionary *_currentStringAttributes;
26 | NSArray *_currentButtonsStringAttributes; // array of dictionaries
27 | NSMutableAttributedString *_fullString;
28 | NSMutableArray *_buttonsStrings; // array of ButtonStrings
29 | }
30 |
31 | @end
32 |
33 | @implementation LTLinkTextView
34 |
35 | - (instancetype)init {
36 | self = [super init];
37 | if(self) {
38 | [self commonInit];
39 | }
40 |
41 | return self;
42 | }
43 |
44 | - (instancetype)initWithCoder:(NSCoder *)aDecoder {
45 | self = [super initWithCoder:aDecoder];
46 | if(self) {
47 | [self commonInit];
48 | }
49 |
50 | return self;
51 | }
52 |
53 | - (instancetype)initWithFrame:(CGRect)frame {
54 | self = [super initWithFrame:frame];
55 | if(self) {
56 | [self commonInit];
57 | }
58 |
59 | return self;
60 | }
61 |
62 | - (void)setFrame:(CGRect)frame {
63 | [super setFrame:frame];
64 | [self setNeedsDisplay];
65 | }
66 |
67 | - (void)setStringAttributes:(NSDictionary*)textInfo withButtonsStringsAttributes:(NSArray*)buttonsStringsInfo; {
68 | NSString *text = textInfo[LTTextStringParameterKey];
69 | if(![text isEqual:_currentString]) {
70 | _currentString = text;
71 | _currentStringAttributes = textInfo;
72 | _currentButtonsStringAttributes = buttonsStringsInfo;
73 |
74 | [self checkButtonsAttributes];
75 | // redraw vew with new string
76 | _oldSize = CGSizeZero;
77 | [self setNeedsDisplay];
78 | }
79 | }
80 |
81 | #pragma mark - Private Methods
82 |
83 | - (void)commonInit {
84 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
85 | tapGesture.numberOfTapsRequired = 1;
86 | [self addGestureRecognizer:tapGesture];
87 | }
88 |
89 | - (void)handleTap:(UITapGestureRecognizer*)sender {
90 | if(sender.state == UIGestureRecognizerStateEnded) {
91 | CGPoint tapLocation = [sender locationInView:self];
92 |
93 | [_buttonsStrings enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(LTButtonString *buttonString, NSUInteger idx, BOOL *stop) {
94 | CGRect buttonFrame = [buttonString.frames.firstObject CGRectValue];
95 | if(CGRectContainsPoint(buttonFrame, tapLocation)) {
96 | dispatch_async(dispatch_get_main_queue(), ^{
97 | if([self.delegate respondsToSelector:@selector(linkTextView:didSelectButtonWithIndex:title:)]) {
98 | [self.delegate linkTextView:self didSelectButtonWithIndex:idx title:buttonString.text];
99 | }
100 | });
101 | *stop = YES;
102 | }
103 | }];
104 | }
105 | }
106 |
107 | - (void)checkButtonsAttributes {
108 | NSMutableParagraphStyle *pStyle = _currentStringAttributes[NSParagraphStyleAttributeName];
109 | NSMutableArray *buttonsAttr = [_currentButtonsStringAttributes mutableCopy];
110 |
111 | for(int i = 0; i < _currentButtonsStringAttributes.count; i++) {
112 | NSMutableDictionary *buttonAttr = [_currentButtonsStringAttributes[i] mutableCopy];
113 |
114 | if(pStyle)
115 | buttonAttr[NSParagraphStyleAttributeName] = pStyle;
116 | if(!buttonAttr[NSFontAttributeName] && _currentStringAttributes[NSFontAttributeName])
117 | buttonAttr[NSFontAttributeName] = _currentStringAttributes[NSFontAttributeName];
118 | if(!buttonAttr[NSForegroundColorAttributeName] && _currentStringAttributes[NSForegroundColorAttributeName])
119 | buttonAttr[NSForegroundColorAttributeName] = _currentStringAttributes[NSForegroundColorAttributeName];
120 |
121 | buttonsAttr[i] = [buttonAttr copy];
122 | }
123 |
124 | _currentButtonsStringAttributes = [buttonsAttr copy];
125 | }
126 |
127 | - (void)formatCurrentString {
128 | _buttonsStrings = [NSMutableArray new];
129 |
130 | NSMutableAttributedString *attrFullString = [[NSMutableAttributedString alloc] initWithString:_currentString];
131 | NSDictionary *attributes = _currentStringAttributes;
132 | [attrFullString setAttributes:attributes range:NSMakeRange(0, _currentString.length)];
133 | _fullString = attrFullString;
134 |
135 | for (NSDictionary *buttonInfo in _currentButtonsStringAttributes) {
136 | NSString *buttonText = buttonInfo[LTTextStringParameterKey];
137 | NSRange range = [_currentString rangeOfString:buttonText];
138 |
139 | if (range.location != NSNotFound) {
140 | LTButtonString *btnStr = [LTButtonString new];
141 | btnStr.text = buttonText;
142 | btnStr.range = range;
143 | [_buttonsStrings addObject:btnStr];
144 |
145 | [attrFullString setAttributes:buttonInfo range:range];
146 | }
147 | }
148 | }
149 |
150 | - (BOOL)updateFormattingWithButtonsStrings:(NSArray*)newButtonsStrings {
151 | if(!newButtonsStrings.count)
152 | return NO;
153 |
154 | BOOL retFlag = NO;
155 | LTButtonString *buttonString = newButtonsStrings.firstObject;
156 |
157 | NSMutableString *mutableString = [[NSMutableString alloc] initWithString:_currentString];
158 | CGPathRef path = CGPathCreateWithRect(self.bounds, NULL);
159 | CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)_fullString);
160 | CTFrameRef frame = CTFramesetterCreateFrame(framesetter,
161 | CFRangeMake(0, [_fullString length]), path, NULL);
162 |
163 | CFArrayRef lines = CTFrameGetLines(frame);
164 | NSArray *linesArr = (__bridge NSArray*)lines;
165 |
166 | for (id line in linesArr) {
167 | CFRange range = CTLineGetStringRange((CTLineRef)line);
168 | if((buttonString.range.location >= range.location && buttonString.range.location <= (range.location + range.length)) &&
169 | ((buttonString.range.location+buttonString.range.length) > (range.location + range.length)))
170 | {
171 | [mutableString insertString:@"\r" atIndex:buttonString.range.location];
172 | retFlag = YES;
173 | break;
174 | }
175 | }
176 |
177 | CFRelease(frame);
178 | CFRelease(path);
179 | CFRelease(framesetter);
180 |
181 | _currentString = mutableString;
182 | [self formatCurrentString];
183 |
184 | NSMutableArray *newArr = [newButtonsStrings mutableCopy];
185 | [newArr removeObjectAtIndex:0];
186 | BOOL flag = [self updateFormattingWithButtonsStrings:newArr];
187 | return flag || retFlag;
188 | }
189 |
190 | - (CGFloat)getWidthForButtonAttributes:(NSDictionary*)buttonInfo {
191 | NSString *buttonText = buttonInfo[LTTextStringParameterKey];
192 | NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:buttonText];
193 | [attrString setAttributes:buttonInfo range:NSMakeRange(0, buttonText.length)];
194 |
195 | CGFloat fontSize = [UIFont systemFontOfSize:[UIFont labelFontSize]].pointSize - 4.0;
196 | UIFont *buttonFont = buttonInfo[NSFontAttributeName];
197 | if(buttonFont)
198 | fontSize = buttonFont.pointSize;
199 |
200 | CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attrString);
201 | CGPathRef path = CGPathCreateWithRect(CGRectMake(0.0, 0.0, CGRectGetWidth(self.bounds), fontSize+5), NULL);
202 | CTFrameRef frame = CTFramesetterCreateFrame(framesetter,
203 | CFRangeMake(0, [buttonText length]), path, NULL);
204 |
205 | CFArrayRef lines = CTFrameGetLines(frame);
206 | NSArray *linesArr = (__bridge NSArray*)lines;
207 | CGFloat width = CTLineGetTypographicBounds((CTLineRef)linesArr.firstObject, NULL, NULL, NULL);
208 |
209 | CFRelease(frame);
210 | CFRelease(path);
211 | CFRelease(framesetter);
212 |
213 | return width;
214 | }
215 |
216 | - (BOOL)isNewSize:(CGSize)newSize {
217 | if(newSize.width != _oldSize.width)
218 | return YES;
219 | if(newSize.height != _oldSize.height)
220 | return YES;
221 |
222 | return NO;
223 | }
224 |
225 | - (void)drawRect:(CGRect)rect {
226 | [super drawRect:rect];
227 | if ([self isNewSize:rect.size] && _currentString) {
228 | _oldSize = rect.size;
229 |
230 | [self formatCurrentString];
231 | [self updateFormattingWithButtonsStrings:_buttonsStrings];
232 |
233 | CGContextRef context = UIGraphicsGetCurrentContext();
234 |
235 | CGContextSetTextMatrix(context, CGAffineTransformIdentity);
236 | CGContextTranslateCTM(context, 0, self.bounds.size.height);
237 | CGContextScaleCTM(context, 1.0, -1.0);
238 |
239 | CGPathRef path = CGPathCreateWithRect(self.bounds, NULL);
240 | CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)_fullString);
241 | if(framesetter) {
242 | CTFrameRef frame = CTFramesetterCreateFrame(framesetter,
243 | CFRangeMake(0, [_fullString length]), path, NULL);
244 | CTFrameDraw(frame, context);
245 |
246 | CFArrayRef lines = CTFrameGetLines(frame);
247 | NSArray *linesArr = (__bridge NSArray*)lines;
248 | CGPoint origins[linesArr.count];
249 |
250 | CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), origins);
251 | for (int n = 0; n < _buttonsStrings.count; n++) {
252 | LTButtonString *buttonString = _buttonsStrings[n];
253 | [buttonString.frames removeAllObjects];
254 | NSDictionary *buttonInfo = _currentButtonsStringAttributes[n];
255 | for (int i = 0; i < linesArr.count; i++) {
256 | CTLineRef line = (__bridge CTLineRef)linesArr[i];
257 | CFRange range = CTLineGetStringRange(line);
258 | if(buttonString.range.location >= range.location && buttonString.range.location < (range.location + range.length)) {
259 | CGFloat fontSize = [UIFont systemFontOfSize:[UIFont labelFontSize]].pointSize - 4.0;
260 | UIFont *buttonFont = buttonInfo[NSFontAttributeName];
261 | if(buttonFont)
262 | fontSize = buttonFont.pointSize;
263 |
264 | CGFloat startFloat = CTLineGetOffsetForStringIndex(line, buttonString.range.location, NULL);
265 | CGRect buttonFrame = CGRectMake(startFloat + origins[i].x, (CGRectGetHeight(self.bounds) - fontSize - origins[i].y + 2.0), [self getWidthForButtonAttributes:buttonInfo], fontSize);
266 | NSValue *frameValue = [NSValue valueWithCGRect:buttonFrame];
267 | [buttonString.frames addObject:frameValue];
268 | }
269 | }
270 | }
271 |
272 | CFRelease(frame);
273 | CFRelease(path);
274 | CFRelease(framesetter);
275 | }
276 | }
277 | }
278 |
279 | @end
280 |
281 | @implementation LTButtonString
282 |
283 | - (instancetype)init {
284 | self = [super init];
285 | if(self) {
286 | _frames = [NSMutableArray new];
287 | }
288 |
289 | return self;
290 | }
291 |
292 | @end
293 |
--------------------------------------------------------------------------------
/LTTextViewApp/LTTextViewApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1A14503B1B18AFAF00115443 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A14503A1B18AFAF00115443 /* main.m */; };
11 | 1A14503E1B18AFAF00115443 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A14503D1B18AFAF00115443 /* AppDelegate.m */; };
12 | 1A1450411B18AFAF00115443 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1450401B18AFAF00115443 /* ViewController.m */; };
13 | 1A1450441B18AFAF00115443 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A1450421B18AFAF00115443 /* Main.storyboard */; };
14 | 1A1450461B18AFAF00115443 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A1450451B18AFAF00115443 /* Images.xcassets */; };
15 | 1A1450491B18AFAF00115443 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A1450471B18AFAF00115443 /* LaunchScreen.xib */; };
16 | 1A1450551B18AFAF00115443 /* LTTextViewAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1450541B18AFAF00115443 /* LTTextViewAppTests.m */; };
17 | 1A2BD6651B24628E0010AFC1 /* LTLinkTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A2BD6641B24628E0010AFC1 /* LTLinkTextView.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 1A14504F1B18AFAF00115443 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 1A14502D1B18AFAF00115443 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 1A1450341B18AFAF00115443;
26 | remoteInfo = LTTextViewApp;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 1A1450351B18AFAF00115443 /* LTTextViewApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LTTextViewApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 1A1450391B18AFAF00115443 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
33 | 1A14503A1B18AFAF00115443 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
34 | 1A14503C1B18AFAF00115443 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
35 | 1A14503D1B18AFAF00115443 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
36 | 1A14503F1B18AFAF00115443 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
37 | 1A1450401B18AFAF00115443 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
38 | 1A1450431B18AFAF00115443 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | 1A1450451B18AFAF00115443 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
40 | 1A1450481B18AFAF00115443 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
41 | 1A14504E1B18AFAF00115443 /* LTTextViewAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LTTextViewAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 1A1450531B18AFAF00115443 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | 1A1450541B18AFAF00115443 /* LTTextViewAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LTTextViewAppTests.m; sourceTree = ""; };
44 | 1A2BD6631B24628E0010AFC1 /* LTLinkTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LTLinkTextView.h; sourceTree = ""; };
45 | 1A2BD6641B24628E0010AFC1 /* LTLinkTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LTLinkTextView.m; sourceTree = ""; };
46 | /* End PBXFileReference section */
47 |
48 | /* Begin PBXFrameworksBuildPhase section */
49 | 1A1450321B18AFAF00115443 /* Frameworks */ = {
50 | isa = PBXFrameworksBuildPhase;
51 | buildActionMask = 2147483647;
52 | files = (
53 | );
54 | runOnlyForDeploymentPostprocessing = 0;
55 | };
56 | 1A14504B1B18AFAF00115443 /* Frameworks */ = {
57 | isa = PBXFrameworksBuildPhase;
58 | buildActionMask = 2147483647;
59 | files = (
60 | );
61 | runOnlyForDeploymentPostprocessing = 0;
62 | };
63 | /* End PBXFrameworksBuildPhase section */
64 |
65 | /* Begin PBXGroup section */
66 | 1A14502C1B18AFAF00115443 = {
67 | isa = PBXGroup;
68 | children = (
69 | 1A1450371B18AFAF00115443 /* LTTextViewApp */,
70 | 1A1450511B18AFAF00115443 /* LTTextViewAppTests */,
71 | 1A1450361B18AFAF00115443 /* Products */,
72 | );
73 | sourceTree = "";
74 | };
75 | 1A1450361B18AFAF00115443 /* Products */ = {
76 | isa = PBXGroup;
77 | children = (
78 | 1A1450351B18AFAF00115443 /* LTTextViewApp.app */,
79 | 1A14504E1B18AFAF00115443 /* LTTextViewAppTests.xctest */,
80 | );
81 | name = Products;
82 | sourceTree = "";
83 | };
84 | 1A1450371B18AFAF00115443 /* LTTextViewApp */ = {
85 | isa = PBXGroup;
86 | children = (
87 | 1A2BD6621B24628E0010AFC1 /* LTTextView */,
88 | 1A14503C1B18AFAF00115443 /* AppDelegate.h */,
89 | 1A14503D1B18AFAF00115443 /* AppDelegate.m */,
90 | 1A14503F1B18AFAF00115443 /* ViewController.h */,
91 | 1A1450401B18AFAF00115443 /* ViewController.m */,
92 | 1A1450421B18AFAF00115443 /* Main.storyboard */,
93 | 1A1450451B18AFAF00115443 /* Images.xcassets */,
94 | 1A1450471B18AFAF00115443 /* LaunchScreen.xib */,
95 | 1A1450381B18AFAF00115443 /* Supporting Files */,
96 | );
97 | path = LTTextViewApp;
98 | sourceTree = "";
99 | };
100 | 1A1450381B18AFAF00115443 /* Supporting Files */ = {
101 | isa = PBXGroup;
102 | children = (
103 | 1A1450391B18AFAF00115443 /* Info.plist */,
104 | 1A14503A1B18AFAF00115443 /* main.m */,
105 | );
106 | name = "Supporting Files";
107 | sourceTree = "";
108 | };
109 | 1A1450511B18AFAF00115443 /* LTTextViewAppTests */ = {
110 | isa = PBXGroup;
111 | children = (
112 | 1A1450541B18AFAF00115443 /* LTTextViewAppTests.m */,
113 | 1A1450521B18AFAF00115443 /* Supporting Files */,
114 | );
115 | path = LTTextViewAppTests;
116 | sourceTree = "";
117 | };
118 | 1A1450521B18AFAF00115443 /* Supporting Files */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 1A1450531B18AFAF00115443 /* Info.plist */,
122 | );
123 | name = "Supporting Files";
124 | sourceTree = "";
125 | };
126 | 1A2BD6621B24628E0010AFC1 /* LTTextView */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 1A2BD6631B24628E0010AFC1 /* LTLinkTextView.h */,
130 | 1A2BD6641B24628E0010AFC1 /* LTLinkTextView.m */,
131 | );
132 | name = LTTextView;
133 | path = ../../LTTextView;
134 | sourceTree = "";
135 | };
136 | /* End PBXGroup section */
137 |
138 | /* Begin PBXNativeTarget section */
139 | 1A1450341B18AFAF00115443 /* LTTextViewApp */ = {
140 | isa = PBXNativeTarget;
141 | buildConfigurationList = 1A1450581B18AFAF00115443 /* Build configuration list for PBXNativeTarget "LTTextViewApp" */;
142 | buildPhases = (
143 | 1A1450311B18AFAF00115443 /* Sources */,
144 | 1A1450321B18AFAF00115443 /* Frameworks */,
145 | 1A1450331B18AFAF00115443 /* Resources */,
146 | );
147 | buildRules = (
148 | );
149 | dependencies = (
150 | );
151 | name = LTTextViewApp;
152 | productName = LTTextViewApp;
153 | productReference = 1A1450351B18AFAF00115443 /* LTTextViewApp.app */;
154 | productType = "com.apple.product-type.application";
155 | };
156 | 1A14504D1B18AFAF00115443 /* LTTextViewAppTests */ = {
157 | isa = PBXNativeTarget;
158 | buildConfigurationList = 1A14505B1B18AFAF00115443 /* Build configuration list for PBXNativeTarget "LTTextViewAppTests" */;
159 | buildPhases = (
160 | 1A14504A1B18AFAF00115443 /* Sources */,
161 | 1A14504B1B18AFAF00115443 /* Frameworks */,
162 | 1A14504C1B18AFAF00115443 /* Resources */,
163 | );
164 | buildRules = (
165 | );
166 | dependencies = (
167 | 1A1450501B18AFAF00115443 /* PBXTargetDependency */,
168 | );
169 | name = LTTextViewAppTests;
170 | productName = LTTextViewAppTests;
171 | productReference = 1A14504E1B18AFAF00115443 /* LTTextViewAppTests.xctest */;
172 | productType = "com.apple.product-type.bundle.unit-test";
173 | };
174 | /* End PBXNativeTarget section */
175 |
176 | /* Begin PBXProject section */
177 | 1A14502D1B18AFAF00115443 /* Project object */ = {
178 | isa = PBXProject;
179 | attributes = {
180 | LastUpgradeCheck = 0730;
181 | ORGANIZATIONNAME = ZZICo;
182 | TargetAttributes = {
183 | 1A1450341B18AFAF00115443 = {
184 | CreatedOnToolsVersion = 6.3.2;
185 | };
186 | 1A14504D1B18AFAF00115443 = {
187 | CreatedOnToolsVersion = 6.3.2;
188 | TestTargetID = 1A1450341B18AFAF00115443;
189 | };
190 | };
191 | };
192 | buildConfigurationList = 1A1450301B18AFAF00115443 /* Build configuration list for PBXProject "LTTextViewApp" */;
193 | compatibilityVersion = "Xcode 3.2";
194 | developmentRegion = English;
195 | hasScannedForEncodings = 0;
196 | knownRegions = (
197 | en,
198 | Base,
199 | );
200 | mainGroup = 1A14502C1B18AFAF00115443;
201 | productRefGroup = 1A1450361B18AFAF00115443 /* Products */;
202 | projectDirPath = "";
203 | projectRoot = "";
204 | targets = (
205 | 1A1450341B18AFAF00115443 /* LTTextViewApp */,
206 | 1A14504D1B18AFAF00115443 /* LTTextViewAppTests */,
207 | );
208 | };
209 | /* End PBXProject section */
210 |
211 | /* Begin PBXResourcesBuildPhase section */
212 | 1A1450331B18AFAF00115443 /* Resources */ = {
213 | isa = PBXResourcesBuildPhase;
214 | buildActionMask = 2147483647;
215 | files = (
216 | 1A1450441B18AFAF00115443 /* Main.storyboard in Resources */,
217 | 1A1450491B18AFAF00115443 /* LaunchScreen.xib in Resources */,
218 | 1A1450461B18AFAF00115443 /* Images.xcassets in Resources */,
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | };
222 | 1A14504C1B18AFAF00115443 /* Resources */ = {
223 | isa = PBXResourcesBuildPhase;
224 | buildActionMask = 2147483647;
225 | files = (
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | };
229 | /* End PBXResourcesBuildPhase section */
230 |
231 | /* Begin PBXSourcesBuildPhase section */
232 | 1A1450311B18AFAF00115443 /* Sources */ = {
233 | isa = PBXSourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | 1A1450411B18AFAF00115443 /* ViewController.m in Sources */,
237 | 1A2BD6651B24628E0010AFC1 /* LTLinkTextView.m in Sources */,
238 | 1A14503E1B18AFAF00115443 /* AppDelegate.m in Sources */,
239 | 1A14503B1B18AFAF00115443 /* main.m in Sources */,
240 | );
241 | runOnlyForDeploymentPostprocessing = 0;
242 | };
243 | 1A14504A1B18AFAF00115443 /* Sources */ = {
244 | isa = PBXSourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | 1A1450551B18AFAF00115443 /* LTTextViewAppTests.m in Sources */,
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | /* End PBXSourcesBuildPhase section */
252 |
253 | /* Begin PBXTargetDependency section */
254 | 1A1450501B18AFAF00115443 /* PBXTargetDependency */ = {
255 | isa = PBXTargetDependency;
256 | target = 1A1450341B18AFAF00115443 /* LTTextViewApp */;
257 | targetProxy = 1A14504F1B18AFAF00115443 /* PBXContainerItemProxy */;
258 | };
259 | /* End PBXTargetDependency section */
260 |
261 | /* Begin PBXVariantGroup section */
262 | 1A1450421B18AFAF00115443 /* Main.storyboard */ = {
263 | isa = PBXVariantGroup;
264 | children = (
265 | 1A1450431B18AFAF00115443 /* Base */,
266 | );
267 | name = Main.storyboard;
268 | sourceTree = "";
269 | };
270 | 1A1450471B18AFAF00115443 /* LaunchScreen.xib */ = {
271 | isa = PBXVariantGroup;
272 | children = (
273 | 1A1450481B18AFAF00115443 /* Base */,
274 | );
275 | name = LaunchScreen.xib;
276 | sourceTree = "";
277 | };
278 | /* End PBXVariantGroup section */
279 |
280 | /* Begin XCBuildConfiguration section */
281 | 1A1450561B18AFAF00115443 /* Debug */ = {
282 | isa = XCBuildConfiguration;
283 | buildSettings = {
284 | ALWAYS_SEARCH_USER_PATHS = NO;
285 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
286 | CLANG_CXX_LIBRARY = "libc++";
287 | CLANG_ENABLE_MODULES = YES;
288 | CLANG_ENABLE_OBJC_ARC = YES;
289 | CLANG_WARN_BOOL_CONVERSION = YES;
290 | CLANG_WARN_CONSTANT_CONVERSION = YES;
291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
292 | CLANG_WARN_EMPTY_BODY = YES;
293 | CLANG_WARN_ENUM_CONVERSION = YES;
294 | CLANG_WARN_INT_CONVERSION = YES;
295 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
296 | CLANG_WARN_UNREACHABLE_CODE = YES;
297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
298 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
299 | COPY_PHASE_STRIP = NO;
300 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
301 | ENABLE_STRICT_OBJC_MSGSEND = YES;
302 | ENABLE_TESTABILITY = YES;
303 | GCC_C_LANGUAGE_STANDARD = gnu99;
304 | GCC_DYNAMIC_NO_PIC = NO;
305 | GCC_NO_COMMON_BLOCKS = YES;
306 | GCC_OPTIMIZATION_LEVEL = 0;
307 | GCC_PREPROCESSOR_DEFINITIONS = (
308 | "DEBUG=1",
309 | "$(inherited)",
310 | );
311 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
314 | GCC_WARN_UNDECLARED_SELECTOR = YES;
315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
316 | GCC_WARN_UNUSED_FUNCTION = YES;
317 | GCC_WARN_UNUSED_VARIABLE = YES;
318 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
319 | MTL_ENABLE_DEBUG_INFO = YES;
320 | ONLY_ACTIVE_ARCH = YES;
321 | SDKROOT = iphoneos;
322 | };
323 | name = Debug;
324 | };
325 | 1A1450571B18AFAF00115443 /* Release */ = {
326 | isa = XCBuildConfiguration;
327 | buildSettings = {
328 | ALWAYS_SEARCH_USER_PATHS = NO;
329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
330 | CLANG_CXX_LIBRARY = "libc++";
331 | CLANG_ENABLE_MODULES = YES;
332 | CLANG_ENABLE_OBJC_ARC = YES;
333 | CLANG_WARN_BOOL_CONVERSION = YES;
334 | CLANG_WARN_CONSTANT_CONVERSION = YES;
335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
336 | CLANG_WARN_EMPTY_BODY = YES;
337 | CLANG_WARN_ENUM_CONVERSION = YES;
338 | CLANG_WARN_INT_CONVERSION = YES;
339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
340 | CLANG_WARN_UNREACHABLE_CODE = YES;
341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
343 | COPY_PHASE_STRIP = NO;
344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
345 | ENABLE_NS_ASSERTIONS = NO;
346 | ENABLE_STRICT_OBJC_MSGSEND = YES;
347 | GCC_C_LANGUAGE_STANDARD = gnu99;
348 | GCC_NO_COMMON_BLOCKS = YES;
349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
351 | GCC_WARN_UNDECLARED_SELECTOR = YES;
352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
353 | GCC_WARN_UNUSED_FUNCTION = YES;
354 | GCC_WARN_UNUSED_VARIABLE = YES;
355 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
356 | MTL_ENABLE_DEBUG_INFO = NO;
357 | SDKROOT = iphoneos;
358 | VALIDATE_PRODUCT = YES;
359 | };
360 | name = Release;
361 | };
362 | 1A1450591B18AFAF00115443 /* Debug */ = {
363 | isa = XCBuildConfiguration;
364 | buildSettings = {
365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
366 | INFOPLIST_FILE = LTTextViewApp/Info.plist;
367 | IPHONEOS_DEPLOYMENT_TARGET = 8.4;
368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
369 | PRODUCT_BUNDLE_IDENTIFIER = "com.zzi.$(PRODUCT_NAME:rfc1034identifier)";
370 | PRODUCT_NAME = "$(TARGET_NAME)";
371 | };
372 | name = Debug;
373 | };
374 | 1A14505A1B18AFAF00115443 /* Release */ = {
375 | isa = XCBuildConfiguration;
376 | buildSettings = {
377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
378 | INFOPLIST_FILE = LTTextViewApp/Info.plist;
379 | IPHONEOS_DEPLOYMENT_TARGET = 8.4;
380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
381 | PRODUCT_BUNDLE_IDENTIFIER = "com.zzi.$(PRODUCT_NAME:rfc1034identifier)";
382 | PRODUCT_NAME = "$(TARGET_NAME)";
383 | };
384 | name = Release;
385 | };
386 | 1A14505C1B18AFAF00115443 /* Debug */ = {
387 | isa = XCBuildConfiguration;
388 | buildSettings = {
389 | BUNDLE_LOADER = "$(TEST_HOST)";
390 | FRAMEWORK_SEARCH_PATHS = (
391 | "$(SDKROOT)/Developer/Library/Frameworks",
392 | "$(inherited)",
393 | );
394 | GCC_PREPROCESSOR_DEFINITIONS = (
395 | "DEBUG=1",
396 | "$(inherited)",
397 | );
398 | INFOPLIST_FILE = LTTextViewAppTests/Info.plist;
399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
400 | PRODUCT_BUNDLE_IDENTIFIER = "com.zzi.$(PRODUCT_NAME:rfc1034identifier)";
401 | PRODUCT_NAME = "$(TARGET_NAME)";
402 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LTTextViewApp.app/LTTextViewApp";
403 | };
404 | name = Debug;
405 | };
406 | 1A14505D1B18AFAF00115443 /* Release */ = {
407 | isa = XCBuildConfiguration;
408 | buildSettings = {
409 | BUNDLE_LOADER = "$(TEST_HOST)";
410 | FRAMEWORK_SEARCH_PATHS = (
411 | "$(SDKROOT)/Developer/Library/Frameworks",
412 | "$(inherited)",
413 | );
414 | INFOPLIST_FILE = LTTextViewAppTests/Info.plist;
415 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
416 | PRODUCT_BUNDLE_IDENTIFIER = "com.zzi.$(PRODUCT_NAME:rfc1034identifier)";
417 | PRODUCT_NAME = "$(TARGET_NAME)";
418 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LTTextViewApp.app/LTTextViewApp";
419 | };
420 | name = Release;
421 | };
422 | /* End XCBuildConfiguration section */
423 |
424 | /* Begin XCConfigurationList section */
425 | 1A1450301B18AFAF00115443 /* Build configuration list for PBXProject "LTTextViewApp" */ = {
426 | isa = XCConfigurationList;
427 | buildConfigurations = (
428 | 1A1450561B18AFAF00115443 /* Debug */,
429 | 1A1450571B18AFAF00115443 /* Release */,
430 | );
431 | defaultConfigurationIsVisible = 0;
432 | defaultConfigurationName = Release;
433 | };
434 | 1A1450581B18AFAF00115443 /* Build configuration list for PBXNativeTarget "LTTextViewApp" */ = {
435 | isa = XCConfigurationList;
436 | buildConfigurations = (
437 | 1A1450591B18AFAF00115443 /* Debug */,
438 | 1A14505A1B18AFAF00115443 /* Release */,
439 | );
440 | defaultConfigurationIsVisible = 0;
441 | defaultConfigurationName = Release;
442 | };
443 | 1A14505B1B18AFAF00115443 /* Build configuration list for PBXNativeTarget "LTTextViewAppTests" */ = {
444 | isa = XCConfigurationList;
445 | buildConfigurations = (
446 | 1A14505C1B18AFAF00115443 /* Debug */,
447 | 1A14505D1B18AFAF00115443 /* Release */,
448 | );
449 | defaultConfigurationIsVisible = 0;
450 | defaultConfigurationName = Release;
451 | };
452 | /* End XCConfigurationList section */
453 | };
454 | rootObject = 1A14502D1B18AFAF00115443 /* Project object */;
455 | }
456 |
--------------------------------------------------------------------------------