├── FMLabel ├── FMLinkLabel.h └── FMLinkLabel.m ├── FMLinkLabel.podspec ├── FMLinkLabel.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── zhoufaming.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── FMLinkLabel.xcscheme │ └── xcschememanagement.plist ├── FMLinkLabel ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FMLabel │ ├── FMLinkLabel.h │ └── FMLinkLabel.m ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── FMLinkLabelTests ├── FMLinkLabelTests.m └── Info.plist ├── FMLinkLabelUITests ├── FMLinkLabelUITests.m └── Info.plist └── LICENSE /FMLabel/FMLinkLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabel.h 3 | // 算高度 4 | // 5 | // Created by 周发明 on 16/9/23. 6 | // Copyright © 2016年 途购. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^FMLinkLabelClickItemBlock)(id transmitBody); 12 | 13 | @class FMLinkLabelClickItem; 14 | 15 | @interface FMLinkLabel : UILabel 16 | 17 | - (void)addClickText:(NSString *)text attributeds:(NSDictionary *)attributeds transmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock; 18 | 19 | - (void)addClickTextAttachmentName:(NSString *)attachmentName TransmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock; 20 | 21 | @end 22 | 23 | @interface FMLinkLabelClickItem :NSObject 24 | 25 | @property(nonatomic, copy)NSString *text; 26 | 27 | @property(nonatomic, assign)NSRange range; 28 | 29 | @property(nonatomic, assign)CGRect textRect; 30 | 31 | @property(nonatomic, strong)NSMutableArray *textRects; 32 | 33 | @property(nonatomic, strong)id transmitBody; 34 | 35 | @property(nonatomic, copy)FMLinkLabelClickItemBlock clickBlock; 36 | 37 | + (instancetype)itemWithText:(NSString *)string range:(NSRange)range transmitBody:(id)transmitBody; 38 | 39 | + (instancetype)itemWithTransmitBody:(id)transmitBody; 40 | 41 | @end 42 | 43 | @interface FMTextAttachment : NSTextAttachment 44 | 45 | @property(nonatomic, copy)NSString *attachmentName; 46 | 47 | @end -------------------------------------------------------------------------------- /FMLabel/FMLinkLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabel.m 3 | // 算高度 4 | // 5 | // Created by 周发明 on 16/9/23. 6 | // Copyright © 2016年 途购. All rights reserved. 7 | // 8 | 9 | #import "FMLinkLabel.h" 10 | 11 | @interface FMLinkLabel () 12 | 13 | @property(nonatomic, strong)NSMutableArray *clickItems; 14 | 15 | @property(nonatomic, strong)NSMutableDictionary *clickAttachmentItems; 16 | 17 | @property(nonatomic, weak)UITextView *textView; 18 | 19 | @end 20 | 21 | @implementation FMLinkLabel 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame{ 24 | 25 | if (self = [super initWithFrame:frame]) { 26 | [self setUp]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)awakeFromNib{ 32 | [self setUp]; 33 | } 34 | 35 | - (void)setUp{ 36 | self.clickItems = [NSMutableArray array]; 37 | self.clickAttachmentItems = [NSMutableDictionary dictionary]; 38 | self.userInteractionEnabled = YES; 39 | self.clipsToBounds = YES; 40 | self.textView.font = self.font; 41 | self.textView.frame = CGRectMake(-5, -8, self.bounds.size.width + 10, self.bounds.size.height + 18); 42 | } 43 | 44 | - (void)addClickItem:(FMLinkLabelClickItem *)item{ 45 | 46 | for (int i = 0; i < item.range.length; i++) { 47 | 48 | NSRange range = NSMakeRange(item.range.location + i, 1); 49 | 50 | self.textView.selectedRange = range; 51 | 52 | CGRect rect = [self.textView firstRectForRange:self.textView.selectedTextRange]; 53 | 54 | self.textView.selectedRange = NSMakeRange(0, 0); 55 | 56 | CGRect textRect = [self.textView convertRect:rect toView:self]; 57 | 58 | NSInteger remainder = (NSInteger)textRect.origin.y % (NSInteger)self.font.lineHeight; 59 | 60 | if (remainder > 0) { 61 | textRect.origin.y += (self.font.lineHeight - remainder); 62 | } 63 | 64 | [item.textRects addObject:[NSValue valueWithCGRect:textRect]]; 65 | 66 | } 67 | 68 | [self.clickItems addObject:item]; 69 | } 70 | 71 | - (void)addClickText:(NSString *)text attributeds:(NSDictionary *)attributeds transmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock{ 72 | 73 | NSMutableAttributedString *attr = nil; 74 | if (self.attributedText) { 75 | attr = [self.attributedText mutableCopy]; 76 | } else { 77 | attr = [[[NSAttributedString alloc] initWithString:self.text] mutableCopy]; 78 | } 79 | 80 | NSRange range = [[attr string] rangeOfString:text]; 81 | 82 | if (range.location != NSNotFound) { 83 | [attr setAttributes:attributeds range:range]; 84 | self.attributedText = attr; 85 | FMLinkLabelClickItem *item = [FMLinkLabelClickItem itemWithText:text range:range transmitBody:transmitBody]; 86 | item.clickBlock = clickBlock; 87 | [self addClickItem:item]; 88 | [attr setAttributes:@{NSFontAttributeName : self.font} range:NSMakeRange(0, attr.length)]; 89 | self.textView.text = [attr string]; 90 | } 91 | } 92 | 93 | - (void)addClickTextAttachmentName:(NSString *)attachmentName TransmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock{ 94 | FMLinkLabelClickItem *item = [FMLinkLabelClickItem itemWithTransmitBody:transmitBody]; 95 | item.clickBlock = clickBlock; 96 | [self.clickAttachmentItems setValue:item forKey:attachmentName]; 97 | } 98 | 99 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 100 | 101 | UITouch *touch = [touches anyObject]; 102 | 103 | CGPoint point = [touch locationInView:self]; 104 | 105 | __block BOOL isClickText = NO; 106 | 107 | [self.clickItems enumerateObjectsUsingBlock:^(FMLinkLabelClickItem *obj, NSUInteger idx, BOOL * _Nonnull stop) { 108 | [obj.textRects enumerateObjectsUsingBlock:^(NSValue *rectValue, NSUInteger idx, BOOL * _Nonnull stop) { 109 | if (CGRectContainsPoint([rectValue CGRectValue], point)) { 110 | if (obj.clickBlock) { 111 | obj.clickBlock(obj.transmitBody); 112 | isClickText = YES; 113 | *stop = YES; 114 | } 115 | } 116 | }]; 117 | }]; 118 | 119 | if (!isClickText) { 120 | if (self.attributedText) { 121 | __weak typeof(self)weakSelf = self; 122 | [self.attributedText enumerateAttribute:NSAttachmentAttributeName inRange:NSMakeRange(0, self.attributedText.length) options:NSAttributedStringEnumerationReverse usingBlock:^(FMTextAttachment* value, NSRange range, BOOL * _Nonnull stop) { 123 | if (value && CGRectEqualToRect(value.bounds, CGRectMake(0, 0, 23, 23))) { 124 | weakSelf.textView.selectedRange = range; 125 | CGRect rect = [weakSelf.textView firstRectForRange:weakSelf.textView.selectedTextRange]; 126 | weakSelf.textView.selectedRange = NSMakeRange(0, 0); 127 | if (CGRectContainsPoint(rect, point)) { 128 | FMLinkLabelClickItem *item = [self.clickAttachmentItems valueForKey:value.attachmentName]; 129 | if (item) { 130 | if (item.clickBlock) { 131 | item.clickBlock(item.transmitBody); 132 | } 133 | } 134 | } 135 | } 136 | }]; 137 | } 138 | } 139 | 140 | } 141 | 142 | - (void)setFont:(UIFont *)font{ 143 | self.textView.font = font; 144 | [super setFont:font]; 145 | } 146 | 147 | - (void)setAttributedText:(NSAttributedString *)attributedText{ 148 | CGSize size = [attributedText boundingRectWithSize:CGSizeMake(self.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size; 149 | self.textView.frame = CGRectMake(-5, -8, size.width + 10, size.height + 16); 150 | self.textView.text = [attributedText string]; 151 | [super setAttributedText:attributedText]; 152 | } 153 | 154 | - (void)setText:(NSString *)text{ 155 | self.textView.text = text; 156 | [super setText:text]; 157 | } 158 | 159 | - (void)layoutSubviews{ 160 | self.textView.frame = CGRectMake(-5, -8, self.bounds.size.width + 10, self.bounds.size.height + 18); 161 | } 162 | 163 | - (UITextView *)textView{ 164 | 165 | if (_textView == nil) { 166 | 167 | UITextView *textView = [[UITextView alloc] init]; 168 | 169 | textView.userInteractionEnabled = NO; 170 | 171 | textView.editable = NO; 172 | 173 | textView.delegate = self; 174 | 175 | [self addSubview:textView]; 176 | 177 | textView.textColor = [UIColor clearColor]; 178 | 179 | textView.backgroundColor = [UIColor clearColor]; 180 | 181 | textView.font = self.font; 182 | 183 | textView.text = self.text; 184 | 185 | _textView = textView; 186 | } 187 | return _textView; 188 | } 189 | 190 | @end 191 | 192 | @implementation FMLinkLabelClickItem 193 | 194 | + (instancetype)itemWithText:(NSString *)text range:(NSRange)range transmitBody:(id)transmitBody{ 195 | 196 | FMLinkLabelClickItem *item = [[FMLinkLabelClickItem alloc] init]; 197 | 198 | item.text = text; 199 | 200 | item.range = range; 201 | 202 | item.transmitBody = transmitBody; 203 | 204 | item.textRects = [NSMutableArray array]; 205 | 206 | return item; 207 | } 208 | 209 | + (instancetype)itemWithTransmitBody:(id)transmitBody{ 210 | return [self itemWithText:nil range:NSMakeRange(0, 0) transmitBody:transmitBody]; 211 | } 212 | 213 | @end 214 | 215 | @implementation FMTextAttachment 216 | 217 | 218 | 219 | @end 220 | -------------------------------------------------------------------------------- /FMLinkLabel.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint FMLinkLabel.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "FMLinkLabel" 19 | s.version = "1.0.0" 20 | s.summary = "Text can response to a click event label" 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | s.description = <<-DESC 28 | DESC 29 | 30 | s.homepage = "https://github.com/CoderFM/FMLinkLabel" 31 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 32 | 33 | 34 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 35 | # 36 | # Licensing your code is important. See http://choosealicense.com for more info. 37 | # CocoaPods will detect a license file if there is a named LICENSE* 38 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 39 | # 40 | 41 | s.license = "MIT (example)" 42 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 43 | 44 | 45 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 46 | # 47 | # Specify the authors of the library, with email addresses. Email addresses 48 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 49 | # accepts just a name if you'd rather not provide an email address. 50 | # 51 | # Specify a social_media_url where others can refer to, for example a twitter 52 | # profile URL. 53 | # 54 | 55 | s.author = { "CoderFM" => "zhoufaming251@163.com" } 56 | # Or just: s.author = "CoderFM" 57 | # s.authors = { "CoderFM" => "zhoufaming251@163.com" } 58 | # s.social_media_url = "http://twitter.com/CoderFM" 59 | 60 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 61 | # 62 | # If this Pod runs only on iOS or OS X, then specify the platform and 63 | # the deployment target. You can optionally include the target after the platform. 64 | # 65 | 66 | # s.platform = :ios 67 | # s.platform = :ios, "7.0" 68 | 69 | # When using multiple platforms 70 | # s.ios.deployment_target = "5.0" 71 | # s.osx.deployment_target = "10.7" 72 | # s.watchos.deployment_target = "2.0" 73 | # s.tvos.deployment_target = "9.0" 74 | 75 | 76 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 77 | # 78 | # Specify the location from where the source should be retrieved. 79 | # Supports git, hg, bzr, svn and HTTP. 80 | # 81 | 82 | s.source = { :git => "https://github.com/CoderFM/FMLinkLabel.git", :tag => "#{s.version}" } 83 | 84 | 85 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 86 | # 87 | # CocoaPods is smart about how it includes source code. For source files 88 | # giving a folder will include any swift, h, m, mm, c & cpp files. 89 | # For header files it will include any header in the folder. 90 | # Not including the public_header_files will make all headers public. 91 | # 92 | 93 | s.source_files = "FMLinkLabel", "FMLabel/*.{h,m}" 94 | s.exclude_files = "Classes/Exclude" 95 | 96 | # s.public_header_files = "Classes/**/*.h" 97 | 98 | 99 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 100 | # 101 | # A list of resources included with the Pod. These are copied into the 102 | # target bundle with a build phase script. Anything else will be cleaned. 103 | # You can preserve files from being cleaned, please don't preserve 104 | # non-essential files like tests, examples and documentation. 105 | # 106 | 107 | # s.resource = "icon.png" 108 | # s.resources = "Resources/*.png" 109 | 110 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 111 | 112 | 113 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 114 | # 115 | # Link your library with frameworks, or libraries. Libraries do not include 116 | # the lib prefix of their name. 117 | # 118 | 119 | # s.framework = "SomeFramework" 120 | # s.frameworks = "SomeFramework", "AnotherFramework" 121 | 122 | # s.library = "iconv" 123 | # s.libraries = "iconv", "xml2" 124 | 125 | 126 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 127 | # 128 | # If your library depends on compiler flags you can set them in the xcconfig hash 129 | # where they will only apply to your library. If you depend on other Podspecs 130 | # you can include multiple dependencies to ensure it works. 131 | 132 | # s.requires_arc = true 133 | 134 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 135 | # s.dependency "JSONKit", "~> 1.4" 136 | 137 | end 138 | -------------------------------------------------------------------------------- /FMLinkLabel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 15304A971D9D2A05006D0CAB /* FMLinkLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 15304A961D9D2A05006D0CAB /* FMLinkLabel.m */; }; 11 | 1537BB181D9CC6C900EEB41E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1537BB171D9CC6C900EEB41E /* main.m */; }; 12 | 1537BB1B1D9CC6C900EEB41E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1537BB1A1D9CC6C900EEB41E /* AppDelegate.m */; }; 13 | 1537BB1E1D9CC6C900EEB41E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1537BB1D1D9CC6C900EEB41E /* ViewController.m */; }; 14 | 1537BB211D9CC6C900EEB41E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1537BB1F1D9CC6C900EEB41E /* Main.storyboard */; }; 15 | 1537BB231D9CC6C900EEB41E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1537BB221D9CC6C900EEB41E /* Assets.xcassets */; }; 16 | 1537BB261D9CC6C900EEB41E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1537BB241D9CC6C900EEB41E /* LaunchScreen.storyboard */; }; 17 | 1537BB311D9CC6C900EEB41E /* FMLinkLabelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1537BB301D9CC6C900EEB41E /* FMLinkLabelTests.m */; }; 18 | 1537BB3C1D9CC6C900EEB41E /* FMLinkLabelUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1537BB3B1D9CC6C900EEB41E /* FMLinkLabelUITests.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 1537BB2D1D9CC6C900EEB41E /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 1537BB0B1D9CC6C900EEB41E /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 1537BB121D9CC6C900EEB41E; 27 | remoteInfo = FMLinkLabel; 28 | }; 29 | 1537BB381D9CC6C900EEB41E /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 1537BB0B1D9CC6C900EEB41E /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 1537BB121D9CC6C900EEB41E; 34 | remoteInfo = FMLinkLabel; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 15304A951D9D2A05006D0CAB /* FMLinkLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMLinkLabel.h; sourceTree = ""; }; 40 | 15304A961D9D2A05006D0CAB /* FMLinkLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMLinkLabel.m; sourceTree = ""; }; 41 | 1537BB131D9CC6C900EEB41E /* FMLinkLabel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FMLinkLabel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 1537BB171D9CC6C900EEB41E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 1537BB191D9CC6C900EEB41E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | 1537BB1A1D9CC6C900EEB41E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | 1537BB1C1D9CC6C900EEB41E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | 1537BB1D1D9CC6C900EEB41E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | 1537BB201D9CC6C900EEB41E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 1537BB221D9CC6C900EEB41E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 1537BB251D9CC6C900EEB41E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 1537BB271D9CC6C900EEB41E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 1537BB2C1D9CC6C900EEB41E /* FMLinkLabelTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FMLinkLabelTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 1537BB301D9CC6C900EEB41E /* FMLinkLabelTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMLinkLabelTests.m; sourceTree = ""; }; 53 | 1537BB321D9CC6C900EEB41E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 1537BB371D9CC6C900EEB41E /* FMLinkLabelUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FMLinkLabelUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 1537BB3B1D9CC6C900EEB41E /* FMLinkLabelUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMLinkLabelUITests.m; sourceTree = ""; }; 56 | 1537BB3D1D9CC6C900EEB41E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 1537BB101D9CC6C900EEB41E /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 1537BB291D9CC6C900EEB41E /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 1537BB341D9CC6C900EEB41E /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 15304A941D9D2A05006D0CAB /* FMLabel */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 15304A951D9D2A05006D0CAB /* FMLinkLabel.h */, 88 | 15304A961D9D2A05006D0CAB /* FMLinkLabel.m */, 89 | ); 90 | path = FMLabel; 91 | sourceTree = ""; 92 | }; 93 | 1537BB0A1D9CC6C900EEB41E = { 94 | isa = PBXGroup; 95 | children = ( 96 | 1537BB151D9CC6C900EEB41E /* FMLinkLabel */, 97 | 1537BB2F1D9CC6C900EEB41E /* FMLinkLabelTests */, 98 | 1537BB3A1D9CC6C900EEB41E /* FMLinkLabelUITests */, 99 | 1537BB141D9CC6C900EEB41E /* Products */, 100 | ); 101 | sourceTree = ""; 102 | }; 103 | 1537BB141D9CC6C900EEB41E /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 1537BB131D9CC6C900EEB41E /* FMLinkLabel.app */, 107 | 1537BB2C1D9CC6C900EEB41E /* FMLinkLabelTests.xctest */, 108 | 1537BB371D9CC6C900EEB41E /* FMLinkLabelUITests.xctest */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 1537BB151D9CC6C900EEB41E /* FMLinkLabel */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 15304A941D9D2A05006D0CAB /* FMLabel */, 117 | 1537BB191D9CC6C900EEB41E /* AppDelegate.h */, 118 | 1537BB1A1D9CC6C900EEB41E /* AppDelegate.m */, 119 | 1537BB1C1D9CC6C900EEB41E /* ViewController.h */, 120 | 1537BB1D1D9CC6C900EEB41E /* ViewController.m */, 121 | 1537BB1F1D9CC6C900EEB41E /* Main.storyboard */, 122 | 1537BB221D9CC6C900EEB41E /* Assets.xcassets */, 123 | 1537BB241D9CC6C900EEB41E /* LaunchScreen.storyboard */, 124 | 1537BB271D9CC6C900EEB41E /* Info.plist */, 125 | 1537BB161D9CC6C900EEB41E /* Supporting Files */, 126 | ); 127 | path = FMLinkLabel; 128 | sourceTree = ""; 129 | }; 130 | 1537BB161D9CC6C900EEB41E /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 1537BB171D9CC6C900EEB41E /* main.m */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | 1537BB2F1D9CC6C900EEB41E /* FMLinkLabelTests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 1537BB301D9CC6C900EEB41E /* FMLinkLabelTests.m */, 142 | 1537BB321D9CC6C900EEB41E /* Info.plist */, 143 | ); 144 | path = FMLinkLabelTests; 145 | sourceTree = ""; 146 | }; 147 | 1537BB3A1D9CC6C900EEB41E /* FMLinkLabelUITests */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 1537BB3B1D9CC6C900EEB41E /* FMLinkLabelUITests.m */, 151 | 1537BB3D1D9CC6C900EEB41E /* Info.plist */, 152 | ); 153 | path = FMLinkLabelUITests; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 1537BB121D9CC6C900EEB41E /* FMLinkLabel */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 1537BB401D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabel" */; 162 | buildPhases = ( 163 | 1537BB0F1D9CC6C900EEB41E /* Sources */, 164 | 1537BB101D9CC6C900EEB41E /* Frameworks */, 165 | 1537BB111D9CC6C900EEB41E /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = FMLinkLabel; 172 | productName = FMLinkLabel; 173 | productReference = 1537BB131D9CC6C900EEB41E /* FMLinkLabel.app */; 174 | productType = "com.apple.product-type.application"; 175 | }; 176 | 1537BB2B1D9CC6C900EEB41E /* FMLinkLabelTests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1537BB431D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabelTests" */; 179 | buildPhases = ( 180 | 1537BB281D9CC6C900EEB41E /* Sources */, 181 | 1537BB291D9CC6C900EEB41E /* Frameworks */, 182 | 1537BB2A1D9CC6C900EEB41E /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 1537BB2E1D9CC6C900EEB41E /* PBXTargetDependency */, 188 | ); 189 | name = FMLinkLabelTests; 190 | productName = FMLinkLabelTests; 191 | productReference = 1537BB2C1D9CC6C900EEB41E /* FMLinkLabelTests.xctest */; 192 | productType = "com.apple.product-type.bundle.unit-test"; 193 | }; 194 | 1537BB361D9CC6C900EEB41E /* FMLinkLabelUITests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 1537BB461D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabelUITests" */; 197 | buildPhases = ( 198 | 1537BB331D9CC6C900EEB41E /* Sources */, 199 | 1537BB341D9CC6C900EEB41E /* Frameworks */, 200 | 1537BB351D9CC6C900EEB41E /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 1537BB391D9CC6C900EEB41E /* PBXTargetDependency */, 206 | ); 207 | name = FMLinkLabelUITests; 208 | productName = FMLinkLabelUITests; 209 | productReference = 1537BB371D9CC6C900EEB41E /* FMLinkLabelUITests.xctest */; 210 | productType = "com.apple.product-type.bundle.ui-testing"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 1537BB0B1D9CC6C900EEB41E /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0720; 219 | ORGANIZATIONNAME = "周发明"; 220 | TargetAttributes = { 221 | 1537BB121D9CC6C900EEB41E = { 222 | CreatedOnToolsVersion = 7.2.1; 223 | }; 224 | 1537BB2B1D9CC6C900EEB41E = { 225 | CreatedOnToolsVersion = 7.2.1; 226 | TestTargetID = 1537BB121D9CC6C900EEB41E; 227 | }; 228 | 1537BB361D9CC6C900EEB41E = { 229 | CreatedOnToolsVersion = 7.2.1; 230 | TestTargetID = 1537BB121D9CC6C900EEB41E; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = 1537BB0E1D9CC6C900EEB41E /* Build configuration list for PBXProject "FMLinkLabel" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | Base, 241 | ); 242 | mainGroup = 1537BB0A1D9CC6C900EEB41E; 243 | productRefGroup = 1537BB141D9CC6C900EEB41E /* Products */; 244 | projectDirPath = ""; 245 | projectRoot = ""; 246 | targets = ( 247 | 1537BB121D9CC6C900EEB41E /* FMLinkLabel */, 248 | 1537BB2B1D9CC6C900EEB41E /* FMLinkLabelTests */, 249 | 1537BB361D9CC6C900EEB41E /* FMLinkLabelUITests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | 1537BB111D9CC6C900EEB41E /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 1537BB261D9CC6C900EEB41E /* LaunchScreen.storyboard in Resources */, 260 | 1537BB231D9CC6C900EEB41E /* Assets.xcassets in Resources */, 261 | 1537BB211D9CC6C900EEB41E /* Main.storyboard in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | 1537BB2A1D9CC6C900EEB41E /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | 1537BB351D9CC6C900EEB41E /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXResourcesBuildPhase section */ 280 | 281 | /* Begin PBXSourcesBuildPhase section */ 282 | 1537BB0F1D9CC6C900EEB41E /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 1537BB1E1D9CC6C900EEB41E /* ViewController.m in Sources */, 287 | 15304A971D9D2A05006D0CAB /* FMLinkLabel.m in Sources */, 288 | 1537BB1B1D9CC6C900EEB41E /* AppDelegate.m in Sources */, 289 | 1537BB181D9CC6C900EEB41E /* main.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 1537BB281D9CC6C900EEB41E /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 1537BB311D9CC6C900EEB41E /* FMLinkLabelTests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 1537BB331D9CC6C900EEB41E /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 1537BB3C1D9CC6C900EEB41E /* FMLinkLabelUITests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 1537BB2E1D9CC6C900EEB41E /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 1537BB121D9CC6C900EEB41E /* FMLinkLabel */; 315 | targetProxy = 1537BB2D1D9CC6C900EEB41E /* PBXContainerItemProxy */; 316 | }; 317 | 1537BB391D9CC6C900EEB41E /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 1537BB121D9CC6C900EEB41E /* FMLinkLabel */; 320 | targetProxy = 1537BB381D9CC6C900EEB41E /* PBXContainerItemProxy */; 321 | }; 322 | /* End PBXTargetDependency section */ 323 | 324 | /* Begin PBXVariantGroup section */ 325 | 1537BB1F1D9CC6C900EEB41E /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 1537BB201D9CC6C900EEB41E /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | 1537BB241D9CC6C900EEB41E /* LaunchScreen.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 1537BB251D9CC6C900EEB41E /* Base */, 337 | ); 338 | name = LaunchScreen.storyboard; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 1537BB3E1D9CC6C900EEB41E /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | }; 385 | name = Debug; 386 | }; 387 | 1537BB3F1D9CC6C900EEB41E /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 1537BB411D9CC6C900EEB41E /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 428 | INFOPLIST_FILE = FMLinkLabel/Info.plist; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 431 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabel; 432 | PRODUCT_NAME = "$(TARGET_NAME)"; 433 | }; 434 | name = Debug; 435 | }; 436 | 1537BB421D9CC6C900EEB41E /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 440 | INFOPLIST_FILE = FMLinkLabel/Info.plist; 441 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabel; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | }; 446 | name = Release; 447 | }; 448 | 1537BB441D9CC6C900EEB41E /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | BUNDLE_LOADER = "$(TEST_HOST)"; 452 | INFOPLIST_FILE = FMLinkLabelTests/Info.plist; 453 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 454 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabelTests; 455 | PRODUCT_NAME = "$(TARGET_NAME)"; 456 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FMLinkLabel.app/FMLinkLabel"; 457 | }; 458 | name = Debug; 459 | }; 460 | 1537BB451D9CC6C900EEB41E /* Release */ = { 461 | isa = XCBuildConfiguration; 462 | buildSettings = { 463 | BUNDLE_LOADER = "$(TEST_HOST)"; 464 | INFOPLIST_FILE = FMLinkLabelTests/Info.plist; 465 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 466 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabelTests; 467 | PRODUCT_NAME = "$(TARGET_NAME)"; 468 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FMLinkLabel.app/FMLinkLabel"; 469 | }; 470 | name = Release; 471 | }; 472 | 1537BB471D9CC6C900EEB41E /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | INFOPLIST_FILE = FMLinkLabelUITests/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 477 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabelUITests; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | TEST_TARGET_NAME = FMLinkLabel; 480 | USES_XCTRUNNER = YES; 481 | }; 482 | name = Debug; 483 | }; 484 | 1537BB481D9CC6C900EEB41E /* Release */ = { 485 | isa = XCBuildConfiguration; 486 | buildSettings = { 487 | INFOPLIST_FILE = FMLinkLabelUITests/Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 489 | PRODUCT_BUNDLE_IDENTIFIER = com.zfm.FMLinkLabelUITests; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | TEST_TARGET_NAME = FMLinkLabel; 492 | USES_XCTRUNNER = YES; 493 | }; 494 | name = Release; 495 | }; 496 | /* End XCBuildConfiguration section */ 497 | 498 | /* Begin XCConfigurationList section */ 499 | 1537BB0E1D9CC6C900EEB41E /* Build configuration list for PBXProject "FMLinkLabel" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | 1537BB3E1D9CC6C900EEB41E /* Debug */, 503 | 1537BB3F1D9CC6C900EEB41E /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | 1537BB401D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabel" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | 1537BB411D9CC6C900EEB41E /* Debug */, 512 | 1537BB421D9CC6C900EEB41E /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | 1537BB431D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabelTests" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 1537BB441D9CC6C900EEB41E /* Debug */, 521 | 1537BB451D9CC6C900EEB41E /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 1537BB461D9CC6C900EEB41E /* Build configuration list for PBXNativeTarget "FMLinkLabelUITests" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 1537BB471D9CC6C900EEB41E /* Debug */, 530 | 1537BB481D9CC6C900EEB41E /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | defaultConfigurationName = Release; 534 | }; 535 | /* End XCConfigurationList section */ 536 | }; 537 | rootObject = 1537BB0B1D9CC6C900EEB41E /* Project object */; 538 | } 539 | -------------------------------------------------------------------------------- /FMLinkLabel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FMLinkLabel.xcodeproj/xcuserdata/zhoufaming.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /FMLinkLabel.xcodeproj/xcuserdata/zhoufaming.xcuserdatad/xcschemes/FMLinkLabel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /FMLinkLabel.xcodeproj/xcuserdata/zhoufaming.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FMLinkLabel.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1537BB121D9CC6C900EEB41E 16 | 17 | primary 18 | 19 | 20 | 1537BB2B1D9CC6C900EEB41E 21 | 22 | primary 23 | 24 | 25 | 1537BB361D9CC6C900EEB41E 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /FMLinkLabel/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FMLinkLabel 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. 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 | -------------------------------------------------------------------------------- /FMLinkLabel/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FMLinkLabel 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. 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 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /FMLinkLabel/Assets.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 | } -------------------------------------------------------------------------------- /FMLinkLabel/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /FMLinkLabel/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /FMLinkLabel/FMLabel/FMLinkLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabel.h 3 | // 算高度 4 | // 5 | // Created by 周发明 on 16/9/23. 6 | // Copyright © 2016年 途购. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^FMLinkLabelClickItemBlock)(id transmitBody); 12 | 13 | @class FMLinkLabelClickItem; 14 | 15 | @interface FMLinkLabel : UILabel 16 | /** 17 | * 添加点击事件, block回调 18 | * 19 | * @param text 需要监听点击的事件文字 20 | * @param attributeds 文字的属性 21 | * @param transmitBody 需要传入Block的参数 22 | * @param clickBlock 回调Block 将传入的body传出来 23 | */ 24 | - (void)addClickText:(NSString *)text attributeds:(NSDictionary *)attributeds transmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock; 25 | /** 26 | * 图片点击的事件 27 | * 28 | * @param attachmentName 附件名字 29 | * @param transmitBody 需要传入Block的参数 30 | * @param clickBlock 回调Block 将传入的body传出来 31 | */ 32 | - (void)addClickTextAttachmentName:(NSString *)attachmentName TransmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock; 33 | 34 | @end 35 | 36 | @interface FMLinkLabelClickItem :NSObject 37 | /** 38 | * 文本 39 | */ 40 | @property(nonatomic, copy)NSString *text; 41 | /** 42 | * 文本对应的范围 43 | */ 44 | @property(nonatomic, assign)NSRange range; 45 | /** 46 | * 文本对应的尺寸 47 | */ 48 | @property(nonatomic, assign)CGRect textRect; 49 | /** 50 | * 文本对应的尺寸集合 51 | */ 52 | @property(nonatomic, strong)NSMutableArray *textRects; 53 | /** 54 | * 需要传参数 55 | */ 56 | @property(nonatomic, strong)id transmitBody; 57 | /** 58 | * 点击事件 59 | */ 60 | @property(nonatomic, copy)FMLinkLabelClickItemBlock clickBlock; 61 | 62 | // 类工厂方法 返回实例 63 | + (instancetype)itemWithText:(NSString *)string range:(NSRange)range transmitBody:(id)transmitBody; 64 | 65 | // 类工厂方法 返回实例 66 | + (instancetype)itemWithTransmitBody:(id)transmitBody; 67 | 68 | @end 69 | 70 | @interface FMTextAttachment : NSTextAttachment 71 | 72 | @property(nonatomic, copy)NSString *attachmentName; 73 | 74 | @end -------------------------------------------------------------------------------- /FMLinkLabel/FMLabel/FMLinkLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabel.m 3 | // 算高度 4 | // 5 | // Created by 周发明 on 16/9/23. 6 | // Copyright © 2016年 途购. All rights reserved. 7 | // 8 | 9 | #import "FMLinkLabel.h" 10 | 11 | @interface FMLinkLabel () 12 | /** 13 | * 存储点击事件的数组 14 | */ 15 | @property(nonatomic, strong)NSMutableArray *clickItems; 16 | /** 17 | * 存储点击图片的字典 18 | */ 19 | @property(nonatomic, strong)NSMutableDictionary *clickAttachmentItems; 20 | /** 21 | * 属性textView 22 | */ 23 | @property(nonatomic, weak)UITextView *textView; 24 | 25 | @end 26 | 27 | @implementation FMLinkLabel 28 | 29 | - (instancetype)initWithFrame:(CGRect)frame{ 30 | 31 | if (self = [super initWithFrame:frame]) { 32 | [self setUp]; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)awakeFromNib{ 38 | [self setUp]; 39 | } 40 | /** 41 | * 初始化 42 | */ 43 | - (void)setUp{ 44 | self.clickItems = [NSMutableArray array]; 45 | self.clickAttachmentItems = [NSMutableDictionary dictionary]; 46 | self.userInteractionEnabled = YES; 47 | self.clipsToBounds = YES; 48 | self.textView.font = self.font; 49 | self.textView.frame = CGRectMake(-5, -8, self.bounds.size.width + 10, self.bounds.size.height + 18); 50 | } 51 | /** 52 | * 添加一个点击事件 53 | * 54 | * @param item 传入点击事件 55 | */ 56 | - (void)addClickItem:(FMLinkLabelClickItem *)item{ 57 | // 循环遍历每一个字符的范围, 防止换行导致的部分不能响应 58 | for (int i = 0; i < item.range.length; i++) { 59 | 60 | NSRange range = NSMakeRange(item.range.location + i, 1); 61 | // 设置TextView的选中范围 62 | self.textView.selectedRange = range; 63 | // 获取选中范围在textView上的尺寸 64 | CGRect rect = [self.textView firstRectForRange:self.textView.selectedTextRange]; 65 | // 将选中范围清空 66 | self.textView.selectedRange = NSMakeRange(0, 0); 67 | // 转换坐标系到本身上来 68 | CGRect textRect = [self.textView convertRect:rect toView:self]; 69 | 70 | // 有点不准确, textView设置内容的时候container有偏移量吧 具体不太清楚 71 | NSInteger remainder = (NSInteger)textRect.origin.y % (NSInteger)self.font.lineHeight; 72 | 73 | if (remainder > 0) { 74 | textRect.origin.y += (self.font.lineHeight - remainder); 75 | } 76 | // 加入这个尺寸到数组 方便判断 77 | [item.textRects addObject:[NSValue valueWithCGRect:textRect]]; 78 | 79 | } 80 | 81 | [self.clickItems addObject:item]; 82 | } 83 | 84 | - (void)addClickText:(NSString *)text attributeds:(NSDictionary *)attributeds transmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock{ 85 | // 根据现有的文本生成可变的富文本 86 | NSMutableAttributedString *attr = nil; 87 | if (self.attributedText) { 88 | attr = [self.attributedText mutableCopy]; 89 | } else { 90 | attr = [[[NSAttributedString alloc] initWithString:self.text] mutableCopy]; 91 | } 92 | // 锁定可以点击文字的范围 93 | NSRange range = [[attr string] rangeOfString:text]; 94 | 95 | if (range.location != NSNotFound) { 96 | [attr setAttributes:attributeds range:range]; 97 | self.attributedText = attr; 98 | FMLinkLabelClickItem *item = [FMLinkLabelClickItem itemWithText:text range:range transmitBody:transmitBody]; 99 | item.clickBlock = clickBlock; 100 | [self addClickItem:item]; 101 | [attr setAttributes:@{NSFontAttributeName : self.font} range:NSMakeRange(0, attr.length)]; 102 | self.textView.text = [attr string]; 103 | } 104 | } 105 | 106 | - (void)addClickTextAttachmentName:(NSString *)attachmentName TransmitBody:(id)transmitBody clickItemBlock:(FMLinkLabelClickItemBlock)clickBlock{ 107 | FMLinkLabelClickItem *item = [FMLinkLabelClickItem itemWithTransmitBody:transmitBody]; 108 | item.clickBlock = clickBlock; 109 | [self.clickAttachmentItems setValue:item forKey:attachmentName]; 110 | } 111 | 112 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 113 | 114 | UITouch *touch = [touches anyObject]; 115 | 116 | CGPoint point = [touch locationInView:self]; 117 | 118 | __block BOOL isClickText = NO; 119 | // 遍历所有的点击事件 120 | [self.clickItems enumerateObjectsUsingBlock:^(FMLinkLabelClickItem *obj, NSUInteger idx, BOOL * _Nonnull stop) { 121 | // 遍历点击事件里的点击范围 122 | [obj.textRects enumerateObjectsUsingBlock:^(NSValue *rectValue, NSUInteger idx, BOOL * _Nonnull stop1) { 123 | if (CGRectContainsPoint([rectValue CGRectValue], point)) { 124 | if (obj.clickBlock) { 125 | obj.clickBlock(obj.transmitBody); 126 | isClickText = YES; 127 | *stop = YES; 128 | *stop1 = YES; 129 | } 130 | } 131 | }]; 132 | }]; 133 | // 遍历点击图片 有待完善 134 | if (!isClickText) { 135 | if (self.attributedText) { 136 | __weak typeof(self)weakSelf = self; 137 | [self.attributedText enumerateAttribute:NSAttachmentAttributeName inRange:NSMakeRange(0, self.attributedText.length) options:NSAttributedStringEnumerationReverse usingBlock:^(FMTextAttachment* value, NSRange range, BOOL * _Nonnull stop) { 138 | if (value && CGRectEqualToRect(value.bounds, CGRectMake(0, 0, 23, 23))) { 139 | weakSelf.textView.selectedRange = range; 140 | CGRect rect = [weakSelf.textView firstRectForRange:weakSelf.textView.selectedTextRange]; 141 | weakSelf.textView.selectedRange = NSMakeRange(0, 0); 142 | if (CGRectContainsPoint(rect, point)) { 143 | FMLinkLabelClickItem *item = [self.clickAttachmentItems valueForKey:value.attachmentName]; 144 | if (item) { 145 | if (item.clickBlock) { 146 | item.clickBlock(item.transmitBody); 147 | } 148 | } 149 | } 150 | } 151 | }]; 152 | } 153 | } 154 | 155 | } 156 | 157 | - (void)setFont:(UIFont *)font{ 158 | self.textView.font = font; 159 | [super setFont:font]; 160 | } 161 | 162 | - (void)setAttributedText:(NSAttributedString *)attributedText{ 163 | CGSize size = [attributedText boundingRectWithSize:CGSizeMake(self.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size; 164 | self.textView.frame = CGRectMake(-5, -8, size.width + 10, size.height + 16); 165 | self.textView.text = [attributedText string]; 166 | [super setAttributedText:attributedText]; 167 | } 168 | 169 | - (void)setText:(NSString *)text{ 170 | self.textView.text = text; 171 | [super setText:text]; 172 | } 173 | 174 | - (void)layoutSubviews{ 175 | self.textView.frame = CGRectMake(-5, -8, self.bounds.size.width + 10, self.bounds.size.height + 18); 176 | } 177 | 178 | - (UITextView *)textView{ 179 | 180 | if (_textView == nil) { 181 | 182 | UITextView *textView = [[UITextView alloc] init]; 183 | 184 | textView.userInteractionEnabled = NO; 185 | 186 | textView.editable = NO; 187 | 188 | textView.delegate = self; 189 | 190 | [self addSubview:textView]; 191 | 192 | textView.textColor = [UIColor clearColor]; 193 | 194 | textView.backgroundColor = [UIColor clearColor]; 195 | 196 | textView.font = self.font; 197 | 198 | textView.text = self.text; 199 | 200 | _textView = textView; 201 | } 202 | return _textView; 203 | } 204 | 205 | @end 206 | 207 | @implementation FMLinkLabelClickItem 208 | 209 | + (instancetype)itemWithText:(NSString *)text range:(NSRange)range transmitBody:(id)transmitBody{ 210 | 211 | FMLinkLabelClickItem *item = [[FMLinkLabelClickItem alloc] init]; 212 | 213 | item.text = text; 214 | 215 | item.range = range; 216 | 217 | item.transmitBody = transmitBody; 218 | 219 | item.textRects = [NSMutableArray array]; 220 | 221 | return item; 222 | } 223 | 224 | + (instancetype)itemWithTransmitBody:(id)transmitBody{ 225 | return [self itemWithText:nil range:NSMakeRange(0, 0) transmitBody:transmitBody]; 226 | } 227 | 228 | @end 229 | 230 | @implementation FMTextAttachment 231 | 232 | 233 | 234 | @end 235 | -------------------------------------------------------------------------------- /FMLinkLabel/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 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /FMLinkLabel/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FMLinkLabel 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FMLinkLabel/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FMLinkLabel 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "FMLinkLabel.h" 11 | 12 | @interface ViewController () 13 | 14 | 15 | @property (weak, nonatomic) IBOutlet FMLinkLabel *label; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | } 24 | 25 | - (void)viewWillAppear:(BOOL)animated{ 26 | [super viewWillAppear:animated]; 27 | 28 | } 29 | - (void)viewDidAppear:(BOOL)animated{ 30 | [super viewDidAppear:animated]; 31 | 32 | NSString *str = @"呵呵哒 :呵呵呵呵呵呵呵呵额哈哈哈呵呵呵呵呵 这里可以点击 呵呵呵额哈哈哈呵呵呵呵呵呵呵呵额哈哈哈呵呵呵呵呵呵呵呵额哈哈哈呵呵呵"; 33 | 34 | self.label.text = str; 35 | 36 | self.label.font = [UIFont systemFontOfSize:20]; 37 | 38 | [self.label addClickText:@"呵呵哒 :" attributeds:@{NSForegroundColorAttributeName : [UIColor orangeColor]} transmitBody:(id)@"呵呵哒 被点击了" clickItemBlock:^(id transmitBody) { 39 | [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"%@", transmitBody] delegate:self cancelButtonTitle:@"取消" otherButtonTitles: nil] show]; 40 | }]; 41 | 42 | [self.label addClickText:@"这里可以点击" attributeds:@{NSForegroundColorAttributeName : [UIColor greenColor]} transmitBody:(id)@"确实可以点击" clickItemBlock:^(id transmitBody) { 43 | [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"%@", transmitBody] delegate:self cancelButtonTitle:@"取消" otherButtonTitles: nil] show]; 44 | }]; 45 | 46 | } 47 | 48 | 49 | - (void)viewWillLayoutSubviews{ 50 | [super viewWillLayoutSubviews]; 51 | } 52 | 53 | - (void)didReceiveMemoryWarning { 54 | [super didReceiveMemoryWarning]; 55 | // Dispose of any resources that can be recreated. 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FMLinkLabel/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FMLinkLabel 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. 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 | -------------------------------------------------------------------------------- /FMLinkLabelTests/FMLinkLabelTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabelTests.m 3 | // FMLinkLabelTests 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FMLinkLabelTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FMLinkLabelTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /FMLinkLabelTests/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 | -------------------------------------------------------------------------------- /FMLinkLabelUITests/FMLinkLabelUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMLinkLabelUITests.m 3 | // FMLinkLabelUITests 4 | // 5 | // Created by 周发明 on 16/9/29. 6 | // Copyright © 2016年 周发明. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FMLinkLabelUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation FMLinkLabelUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FMLinkLabelUITests/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 明 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 | --------------------------------------------------------------------------------