├── .gitignore
├── .travis.yml
├── Example
├── Podfile
├── Podfile.lock
├── Tests
│ ├── Info.plist
│ └── Tests.swift
├── UILabelImageText.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── UILabelImageText-Example.xcscheme
├── UILabelImageText.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── UILabelImageText
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
│ ├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── common_icon_selected.imageset
│ │ ├── Contents.json
│ │ ├── common_icon_selected@2x.png
│ │ └── common_icon_selected@3x.png
│ └── common_icon_unselected.imageset
│ │ ├── Contents.json
│ │ ├── common_icon_unselected@2x.png
│ │ └── common_icon_unselected@3x.png
│ ├── Info.plist
│ └── ViewController.swift
├── LICENSE
├── README.md
├── UILabelImageText.podspec
├── UILabelImageText
├── Assets
│ └── .gitkeep
└── Classes
│ ├── .gitkeep
│ ├── NSString+SubstringRange.swift
│ └── UILabel+ImageText.swift
└── _Pods.xcodeproj
/.gitignore:
--------------------------------------------------------------------------------
1 | # macOS
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata/
15 | *.xccheckout
16 | *.moved-aside
17 | DerivedData
18 | *.hmap
19 | *.ipa
20 |
21 | # Bundler
22 | .bundle
23 |
24 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
25 | # Carthage/Checkouts
26 |
27 | Carthage/Build
28 |
29 | # We recommend against adding the Pods directory to your .gitignore. However
30 | # you should judge for yourself, the pros and cons are mentioned at:
31 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
32 | #
33 | # Note: if you ignore the Pods directory, make sure to uncomment
34 | # `pod install` in .travis.yml
35 | #
36 | # Pods/
37 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/
3 | # * https://github.com/supermarin/xcpretty#usage
4 |
5 | osx_image: xcode7.3
6 | language: objective-c
7 | # cache: cocoapods
8 | # podfile: Example/Podfile
9 | # before_install:
10 | # - gem install cocoapods # Since Travis is not always on latest version
11 | # - pod install --project-directory=Example
12 | script:
13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/UILabelImageText.xcworkspace -scheme UILabelImageText-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
14 | - pod lib lint
15 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | use_frameworks!
4 |
5 | platform :ios, '11.0'
6 |
7 | target 'UILabelImageText_Example' do
8 | pod 'UILabelImageText', :path => '../'
9 |
10 | target 'UILabelImageText_Tests' do
11 | inherit! :search_paths
12 |
13 |
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - UILabelImageText (0.1.2)
3 |
4 | DEPENDENCIES:
5 | - UILabelImageText (from `../`)
6 |
7 | EXTERNAL SOURCES:
8 | UILabelImageText:
9 | :path: "../"
10 |
11 | SPEC CHECKSUMS:
12 | UILabelImageText: 8397324521eb5b2f6fae88ac827c7d868217b7fe
13 |
14 | PODFILE CHECKSUM: 15527ab41035e844aebccd8d0ada09e304549359
15 |
16 | COCOAPODS: 1.12.0
17 |
--------------------------------------------------------------------------------
/Example/Tests/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 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | import UILabelImageText
3 |
4 | class Tests: XCTestCase {
5 |
6 | override func setUp() {
7 | super.setUp()
8 | // Put setup code here. This method is called before the invocation of each test method in the class.
9 | }
10 |
11 | override func tearDown() {
12 | // Put teardown code here. This method is called after the invocation of each test method in the class.
13 | super.tearDown()
14 | }
15 |
16 | func testExample() {
17 | // This is an example of a functional test case.
18 | XCTAssert(true, "Pass")
19 | }
20 |
21 | func testPerformanceExample() {
22 | // This is an example of a performance test case.
23 | self.measure() {
24 | // Put the code you want to measure the time of here.
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Example/UILabelImageText.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0F1A5619CCBC4C85BBBD573B /* Pods_UILabelImageText_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A067B35616DFF3448E8A585 /* Pods_UILabelImageText_Example.framework */; };
11 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
12 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
13 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
14 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
15 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
16 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
17 | CAF0BA2008CF7338509B7086 /* Pods_UILabelImageText_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10F029930B616B05542BF357 /* Pods_UILabelImageText_Tests.framework */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 607FACCF1AFB9204008FA782;
26 | remoteInfo = UILabelImageText;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 10F029930B616B05542BF357 /* Pods_UILabelImageText_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UILabelImageText_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 2A067B35616DFF3448E8A585 /* Pods_UILabelImageText_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UILabelImageText_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 364AB4DE0187742541F6B3A9 /* UILabelImageText.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = UILabelImageText.podspec; path = ../UILabelImageText.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
34 | 607FACD01AFB9204008FA782 /* UILabelImageText_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UILabelImageText_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
35 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
36 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
38 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
40 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
41 | 607FACE51AFB9204008FA782 /* UILabelImageText_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UILabelImageText_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; };
44 | 666DDADEF1A64F429AD3473B /* Pods-UILabelImageText_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UILabelImageText_Tests.release.xcconfig"; path = "Target Support Files/Pods-UILabelImageText_Tests/Pods-UILabelImageText_Tests.release.xcconfig"; sourceTree = ""; };
45 | 6798E026EAFD9FB8763AF346 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; };
46 | 8053963FC77CBA997C5B0899 /* Pods-UILabelImageText_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UILabelImageText_Example.release.xcconfig"; path = "Target Support Files/Pods-UILabelImageText_Example/Pods-UILabelImageText_Example.release.xcconfig"; sourceTree = ""; };
47 | A6BFE8696BD68192AE5D8924 /* Pods-UILabelImageText_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UILabelImageText_Example.debug.xcconfig"; path = "Target Support Files/Pods-UILabelImageText_Example/Pods-UILabelImageText_Example.debug.xcconfig"; sourceTree = ""; };
48 | B96924264865ACC28347242E /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; };
49 | D8D5FE40F8C3D70A6A71A153 /* Pods-UILabelImageText_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UILabelImageText_Tests.debug.xcconfig"; path = "Target Support Files/Pods-UILabelImageText_Tests/Pods-UILabelImageText_Tests.debug.xcconfig"; sourceTree = ""; };
50 | /* End PBXFileReference section */
51 |
52 | /* Begin PBXFrameworksBuildPhase section */
53 | 607FACCD1AFB9204008FA782 /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | 0F1A5619CCBC4C85BBBD573B /* Pods_UILabelImageText_Example.framework in Frameworks */,
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | 607FACE21AFB9204008FA782 /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | CAF0BA2008CF7338509B7086 /* Pods_UILabelImageText_Tests.framework in Frameworks */,
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | /* End PBXFrameworksBuildPhase section */
70 |
71 | /* Begin PBXGroup section */
72 | 2EFDA8E73F75D9E272F1831F /* Frameworks */ = {
73 | isa = PBXGroup;
74 | children = (
75 | 2A067B35616DFF3448E8A585 /* Pods_UILabelImageText_Example.framework */,
76 | 10F029930B616B05542BF357 /* Pods_UILabelImageText_Tests.framework */,
77 | );
78 | name = Frameworks;
79 | sourceTree = "";
80 | };
81 | 607FACC71AFB9204008FA782 = {
82 | isa = PBXGroup;
83 | children = (
84 | 607FACF51AFB993E008FA782 /* Podspec Metadata */,
85 | 607FACD21AFB9204008FA782 /* Example for UILabelImageText */,
86 | 607FACE81AFB9204008FA782 /* Tests */,
87 | 607FACD11AFB9204008FA782 /* Products */,
88 | A60383D34042B5C86C5DD0B0 /* Pods */,
89 | 2EFDA8E73F75D9E272F1831F /* Frameworks */,
90 | );
91 | sourceTree = "";
92 | };
93 | 607FACD11AFB9204008FA782 /* Products */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 607FACD01AFB9204008FA782 /* UILabelImageText_Example.app */,
97 | 607FACE51AFB9204008FA782 /* UILabelImageText_Tests.xctest */,
98 | );
99 | name = Products;
100 | sourceTree = "";
101 | };
102 | 607FACD21AFB9204008FA782 /* Example for UILabelImageText */ = {
103 | isa = PBXGroup;
104 | children = (
105 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */,
106 | 607FACD71AFB9204008FA782 /* ViewController.swift */,
107 | 607FACD91AFB9204008FA782 /* Main.storyboard */,
108 | 607FACDC1AFB9204008FA782 /* Images.xcassets */,
109 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
110 | 607FACD31AFB9204008FA782 /* Supporting Files */,
111 | );
112 | name = "Example for UILabelImageText";
113 | path = UILabelImageText;
114 | sourceTree = "";
115 | };
116 | 607FACD31AFB9204008FA782 /* Supporting Files */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 607FACD41AFB9204008FA782 /* Info.plist */,
120 | );
121 | name = "Supporting Files";
122 | sourceTree = "";
123 | };
124 | 607FACE81AFB9204008FA782 /* Tests */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 607FACEB1AFB9204008FA782 /* Tests.swift */,
128 | 607FACE91AFB9204008FA782 /* Supporting Files */,
129 | );
130 | path = Tests;
131 | sourceTree = "";
132 | };
133 | 607FACE91AFB9204008FA782 /* Supporting Files */ = {
134 | isa = PBXGroup;
135 | children = (
136 | 607FACEA1AFB9204008FA782 /* Info.plist */,
137 | );
138 | name = "Supporting Files";
139 | sourceTree = "";
140 | };
141 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
142 | isa = PBXGroup;
143 | children = (
144 | 364AB4DE0187742541F6B3A9 /* UILabelImageText.podspec */,
145 | B96924264865ACC28347242E /* README.md */,
146 | 6798E026EAFD9FB8763AF346 /* LICENSE */,
147 | );
148 | name = "Podspec Metadata";
149 | sourceTree = "";
150 | };
151 | A60383D34042B5C86C5DD0B0 /* Pods */ = {
152 | isa = PBXGroup;
153 | children = (
154 | A6BFE8696BD68192AE5D8924 /* Pods-UILabelImageText_Example.debug.xcconfig */,
155 | 8053963FC77CBA997C5B0899 /* Pods-UILabelImageText_Example.release.xcconfig */,
156 | D8D5FE40F8C3D70A6A71A153 /* Pods-UILabelImageText_Tests.debug.xcconfig */,
157 | 666DDADEF1A64F429AD3473B /* Pods-UILabelImageText_Tests.release.xcconfig */,
158 | );
159 | path = Pods;
160 | sourceTree = "";
161 | };
162 | /* End PBXGroup section */
163 |
164 | /* Begin PBXNativeTarget section */
165 | 607FACCF1AFB9204008FA782 /* UILabelImageText_Example */ = {
166 | isa = PBXNativeTarget;
167 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UILabelImageText_Example" */;
168 | buildPhases = (
169 | D964740A6EA742E63A2AAA65 /* [CP] Check Pods Manifest.lock */,
170 | 607FACCC1AFB9204008FA782 /* Sources */,
171 | 607FACCD1AFB9204008FA782 /* Frameworks */,
172 | 607FACCE1AFB9204008FA782 /* Resources */,
173 | 4D4E9C383CB34944AA53FD84 /* [CP] Embed Pods Frameworks */,
174 | );
175 | buildRules = (
176 | );
177 | dependencies = (
178 | );
179 | name = UILabelImageText_Example;
180 | productName = UILabelImageText;
181 | productReference = 607FACD01AFB9204008FA782 /* UILabelImageText_Example.app */;
182 | productType = "com.apple.product-type.application";
183 | };
184 | 607FACE41AFB9204008FA782 /* UILabelImageText_Tests */ = {
185 | isa = PBXNativeTarget;
186 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UILabelImageText_Tests" */;
187 | buildPhases = (
188 | D9DEBB06EE67F35233637F0D /* [CP] Check Pods Manifest.lock */,
189 | 607FACE11AFB9204008FA782 /* Sources */,
190 | 607FACE21AFB9204008FA782 /* Frameworks */,
191 | 607FACE31AFB9204008FA782 /* Resources */,
192 | );
193 | buildRules = (
194 | );
195 | dependencies = (
196 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */,
197 | );
198 | name = UILabelImageText_Tests;
199 | productName = Tests;
200 | productReference = 607FACE51AFB9204008FA782 /* UILabelImageText_Tests.xctest */;
201 | productType = "com.apple.product-type.bundle.unit-test";
202 | };
203 | /* End PBXNativeTarget section */
204 |
205 | /* Begin PBXProject section */
206 | 607FACC81AFB9204008FA782 /* Project object */ = {
207 | isa = PBXProject;
208 | attributes = {
209 | LastSwiftUpdateCheck = 0830;
210 | LastUpgradeCheck = 0830;
211 | ORGANIZATIONNAME = CocoaPods;
212 | TargetAttributes = {
213 | 607FACCF1AFB9204008FA782 = {
214 | CreatedOnToolsVersion = 6.3.1;
215 | LastSwiftMigration = 0900;
216 | };
217 | 607FACE41AFB9204008FA782 = {
218 | CreatedOnToolsVersion = 6.3.1;
219 | LastSwiftMigration = 0900;
220 | TestTargetID = 607FACCF1AFB9204008FA782;
221 | };
222 | };
223 | };
224 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "UILabelImageText" */;
225 | compatibilityVersion = "Xcode 3.2";
226 | developmentRegion = English;
227 | hasScannedForEncodings = 0;
228 | knownRegions = (
229 | English,
230 | en,
231 | Base,
232 | );
233 | mainGroup = 607FACC71AFB9204008FA782;
234 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */;
235 | projectDirPath = "";
236 | projectRoot = "";
237 | targets = (
238 | 607FACCF1AFB9204008FA782 /* UILabelImageText_Example */,
239 | 607FACE41AFB9204008FA782 /* UILabelImageText_Tests */,
240 | );
241 | };
242 | /* End PBXProject section */
243 |
244 | /* Begin PBXResourcesBuildPhase section */
245 | 607FACCE1AFB9204008FA782 /* Resources */ = {
246 | isa = PBXResourcesBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
250 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
251 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
252 | );
253 | runOnlyForDeploymentPostprocessing = 0;
254 | };
255 | 607FACE31AFB9204008FA782 /* Resources */ = {
256 | isa = PBXResourcesBuildPhase;
257 | buildActionMask = 2147483647;
258 | files = (
259 | );
260 | runOnlyForDeploymentPostprocessing = 0;
261 | };
262 | /* End PBXResourcesBuildPhase section */
263 |
264 | /* Begin PBXShellScriptBuildPhase section */
265 | 4D4E9C383CB34944AA53FD84 /* [CP] Embed Pods Frameworks */ = {
266 | isa = PBXShellScriptBuildPhase;
267 | buildActionMask = 2147483647;
268 | files = (
269 | );
270 | inputPaths = (
271 | "${PODS_ROOT}/Target Support Files/Pods-UILabelImageText_Example/Pods-UILabelImageText_Example-frameworks.sh",
272 | "${BUILT_PRODUCTS_DIR}/UILabelImageText/UILabelImageText.framework",
273 | );
274 | name = "[CP] Embed Pods Frameworks";
275 | outputPaths = (
276 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UILabelImageText.framework",
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | shellPath = /bin/sh;
280 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UILabelImageText_Example/Pods-UILabelImageText_Example-frameworks.sh\"\n";
281 | showEnvVarsInLog = 0;
282 | };
283 | D964740A6EA742E63A2AAA65 /* [CP] Check Pods Manifest.lock */ = {
284 | isa = PBXShellScriptBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | inputFileListPaths = (
289 | );
290 | inputPaths = (
291 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
292 | "${PODS_ROOT}/Manifest.lock",
293 | );
294 | name = "[CP] Check Pods Manifest.lock";
295 | outputFileListPaths = (
296 | );
297 | outputPaths = (
298 | "$(DERIVED_FILE_DIR)/Pods-UILabelImageText_Example-checkManifestLockResult.txt",
299 | );
300 | runOnlyForDeploymentPostprocessing = 0;
301 | shellPath = /bin/sh;
302 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
303 | showEnvVarsInLog = 0;
304 | };
305 | D9DEBB06EE67F35233637F0D /* [CP] Check Pods Manifest.lock */ = {
306 | isa = PBXShellScriptBuildPhase;
307 | buildActionMask = 2147483647;
308 | files = (
309 | );
310 | inputFileListPaths = (
311 | );
312 | inputPaths = (
313 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
314 | "${PODS_ROOT}/Manifest.lock",
315 | );
316 | name = "[CP] Check Pods Manifest.lock";
317 | outputFileListPaths = (
318 | );
319 | outputPaths = (
320 | "$(DERIVED_FILE_DIR)/Pods-UILabelImageText_Tests-checkManifestLockResult.txt",
321 | );
322 | runOnlyForDeploymentPostprocessing = 0;
323 | shellPath = /bin/sh;
324 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
325 | showEnvVarsInLog = 0;
326 | };
327 | /* End PBXShellScriptBuildPhase section */
328 |
329 | /* Begin PBXSourcesBuildPhase section */
330 | 607FACCC1AFB9204008FA782 /* Sources */ = {
331 | isa = PBXSourcesBuildPhase;
332 | buildActionMask = 2147483647;
333 | files = (
334 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
335 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
336 | );
337 | runOnlyForDeploymentPostprocessing = 0;
338 | };
339 | 607FACE11AFB9204008FA782 /* Sources */ = {
340 | isa = PBXSourcesBuildPhase;
341 | buildActionMask = 2147483647;
342 | files = (
343 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
344 | );
345 | runOnlyForDeploymentPostprocessing = 0;
346 | };
347 | /* End PBXSourcesBuildPhase section */
348 |
349 | /* Begin PBXTargetDependency section */
350 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = {
351 | isa = PBXTargetDependency;
352 | target = 607FACCF1AFB9204008FA782 /* UILabelImageText_Example */;
353 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */;
354 | };
355 | /* End PBXTargetDependency section */
356 |
357 | /* Begin PBXVariantGroup section */
358 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = {
359 | isa = PBXVariantGroup;
360 | children = (
361 | 607FACDA1AFB9204008FA782 /* Base */,
362 | );
363 | name = Main.storyboard;
364 | sourceTree = "";
365 | };
366 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = {
367 | isa = PBXVariantGroup;
368 | children = (
369 | 607FACDF1AFB9204008FA782 /* Base */,
370 | );
371 | name = LaunchScreen.xib;
372 | sourceTree = "";
373 | };
374 | /* End PBXVariantGroup section */
375 |
376 | /* Begin XCBuildConfiguration section */
377 | 607FACED1AFB9204008FA782 /* Debug */ = {
378 | isa = XCBuildConfiguration;
379 | buildSettings = {
380 | ALWAYS_SEARCH_USER_PATHS = NO;
381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
382 | CLANG_CXX_LIBRARY = "libc++";
383 | CLANG_ENABLE_MODULES = YES;
384 | CLANG_ENABLE_OBJC_ARC = YES;
385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
386 | CLANG_WARN_BOOL_CONVERSION = YES;
387 | CLANG_WARN_COMMA = YES;
388 | CLANG_WARN_CONSTANT_CONVERSION = YES;
389 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
390 | CLANG_WARN_EMPTY_BODY = YES;
391 | CLANG_WARN_ENUM_CONVERSION = YES;
392 | CLANG_WARN_INFINITE_RECURSION = YES;
393 | CLANG_WARN_INT_CONVERSION = YES;
394 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
395 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
397 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
398 | CLANG_WARN_STRICT_PROTOTYPES = YES;
399 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
400 | CLANG_WARN_UNREACHABLE_CODE = YES;
401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
402 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
403 | COPY_PHASE_STRIP = NO;
404 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
405 | ENABLE_STRICT_OBJC_MSGSEND = YES;
406 | ENABLE_TESTABILITY = YES;
407 | GCC_C_LANGUAGE_STANDARD = gnu99;
408 | GCC_DYNAMIC_NO_PIC = NO;
409 | GCC_NO_COMMON_BLOCKS = YES;
410 | GCC_OPTIMIZATION_LEVEL = 0;
411 | GCC_PREPROCESSOR_DEFINITIONS = (
412 | "DEBUG=1",
413 | "$(inherited)",
414 | );
415 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
418 | GCC_WARN_UNDECLARED_SELECTOR = YES;
419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
420 | GCC_WARN_UNUSED_FUNCTION = YES;
421 | GCC_WARN_UNUSED_VARIABLE = YES;
422 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
423 | MTL_ENABLE_DEBUG_INFO = YES;
424 | ONLY_ACTIVE_ARCH = YES;
425 | SDKROOT = iphoneos;
426 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
427 | };
428 | name = Debug;
429 | };
430 | 607FACEE1AFB9204008FA782 /* Release */ = {
431 | isa = XCBuildConfiguration;
432 | buildSettings = {
433 | ALWAYS_SEARCH_USER_PATHS = NO;
434 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
435 | CLANG_CXX_LIBRARY = "libc++";
436 | CLANG_ENABLE_MODULES = YES;
437 | CLANG_ENABLE_OBJC_ARC = YES;
438 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
439 | CLANG_WARN_BOOL_CONVERSION = YES;
440 | CLANG_WARN_COMMA = YES;
441 | CLANG_WARN_CONSTANT_CONVERSION = YES;
442 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
443 | CLANG_WARN_EMPTY_BODY = YES;
444 | CLANG_WARN_ENUM_CONVERSION = YES;
445 | CLANG_WARN_INFINITE_RECURSION = YES;
446 | CLANG_WARN_INT_CONVERSION = YES;
447 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
448 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
449 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
450 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
451 | CLANG_WARN_STRICT_PROTOTYPES = YES;
452 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
453 | CLANG_WARN_UNREACHABLE_CODE = YES;
454 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
455 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
456 | COPY_PHASE_STRIP = NO;
457 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
458 | ENABLE_NS_ASSERTIONS = NO;
459 | ENABLE_STRICT_OBJC_MSGSEND = YES;
460 | GCC_C_LANGUAGE_STANDARD = gnu99;
461 | GCC_NO_COMMON_BLOCKS = YES;
462 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
463 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
464 | GCC_WARN_UNDECLARED_SELECTOR = YES;
465 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
466 | GCC_WARN_UNUSED_FUNCTION = YES;
467 | GCC_WARN_UNUSED_VARIABLE = YES;
468 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
469 | MTL_ENABLE_DEBUG_INFO = NO;
470 | SDKROOT = iphoneos;
471 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
472 | VALIDATE_PRODUCT = YES;
473 | };
474 | name = Release;
475 | };
476 | 607FACF01AFB9204008FA782 /* Debug */ = {
477 | isa = XCBuildConfiguration;
478 | baseConfigurationReference = A6BFE8696BD68192AE5D8924 /* Pods-UILabelImageText_Example.debug.xcconfig */;
479 | buildSettings = {
480 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
481 | INFOPLIST_FILE = UILabelImageText/Info.plist;
482 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
484 | MODULE_NAME = ExampleApp;
485 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
486 | PRODUCT_NAME = "$(TARGET_NAME)";
487 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
488 | SWIFT_VERSION = 4.0;
489 | };
490 | name = Debug;
491 | };
492 | 607FACF11AFB9204008FA782 /* Release */ = {
493 | isa = XCBuildConfiguration;
494 | baseConfigurationReference = 8053963FC77CBA997C5B0899 /* Pods-UILabelImageText_Example.release.xcconfig */;
495 | buildSettings = {
496 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
497 | INFOPLIST_FILE = UILabelImageText/Info.plist;
498 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
499 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
500 | MODULE_NAME = ExampleApp;
501 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
502 | PRODUCT_NAME = "$(TARGET_NAME)";
503 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
504 | SWIFT_VERSION = 4.0;
505 | };
506 | name = Release;
507 | };
508 | 607FACF31AFB9204008FA782 /* Debug */ = {
509 | isa = XCBuildConfiguration;
510 | baseConfigurationReference = D8D5FE40F8C3D70A6A71A153 /* Pods-UILabelImageText_Tests.debug.xcconfig */;
511 | buildSettings = {
512 | FRAMEWORK_SEARCH_PATHS = (
513 | "$(PLATFORM_DIR)/Developer/Library/Frameworks",
514 | "$(inherited)",
515 | );
516 | GCC_PREPROCESSOR_DEFINITIONS = (
517 | "DEBUG=1",
518 | "$(inherited)",
519 | );
520 | INFOPLIST_FILE = Tests/Info.plist;
521 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
523 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
524 | PRODUCT_NAME = "$(TARGET_NAME)";
525 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
526 | SWIFT_VERSION = 4.0;
527 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UILabelImageText_Example.app/UILabelImageText_Example";
528 | };
529 | name = Debug;
530 | };
531 | 607FACF41AFB9204008FA782 /* Release */ = {
532 | isa = XCBuildConfiguration;
533 | baseConfigurationReference = 666DDADEF1A64F429AD3473B /* Pods-UILabelImageText_Tests.release.xcconfig */;
534 | buildSettings = {
535 | FRAMEWORK_SEARCH_PATHS = (
536 | "$(PLATFORM_DIR)/Developer/Library/Frameworks",
537 | "$(inherited)",
538 | );
539 | INFOPLIST_FILE = Tests/Info.plist;
540 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
542 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
543 | PRODUCT_NAME = "$(TARGET_NAME)";
544 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
545 | SWIFT_VERSION = 4.0;
546 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UILabelImageText_Example.app/UILabelImageText_Example";
547 | };
548 | name = Release;
549 | };
550 | /* End XCBuildConfiguration section */
551 |
552 | /* Begin XCConfigurationList section */
553 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "UILabelImageText" */ = {
554 | isa = XCConfigurationList;
555 | buildConfigurations = (
556 | 607FACED1AFB9204008FA782 /* Debug */,
557 | 607FACEE1AFB9204008FA782 /* Release */,
558 | );
559 | defaultConfigurationIsVisible = 0;
560 | defaultConfigurationName = Release;
561 | };
562 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UILabelImageText_Example" */ = {
563 | isa = XCConfigurationList;
564 | buildConfigurations = (
565 | 607FACF01AFB9204008FA782 /* Debug */,
566 | 607FACF11AFB9204008FA782 /* Release */,
567 | );
568 | defaultConfigurationIsVisible = 0;
569 | defaultConfigurationName = Release;
570 | };
571 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "UILabelImageText_Tests" */ = {
572 | isa = XCConfigurationList;
573 | buildConfigurations = (
574 | 607FACF31AFB9204008FA782 /* Debug */,
575 | 607FACF41AFB9204008FA782 /* Release */,
576 | );
577 | defaultConfigurationIsVisible = 0;
578 | defaultConfigurationName = Release;
579 | };
580 | /* End XCConfigurationList section */
581 | };
582 | rootObject = 607FACC81AFB9204008FA782 /* Project object */;
583 | }
584 |
--------------------------------------------------------------------------------
/Example/UILabelImageText.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/UILabelImageText.xcodeproj/xcshareddata/xcschemes/UILabelImageText-Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
45 |
46 |
48 |
54 |
55 |
56 |
57 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
80 |
82 |
88 |
89 |
90 |
91 |
92 |
93 |
99 |
101 |
107 |
108 |
109 |
110 |
112 |
113 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/Example/UILabelImageText.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/UILabelImageText.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // UILabelImageText
4 | //
5 | // Created by chenwuqi on 04/27/2023.
6 | // Copyright (c) 2023 chenwuqi. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // 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.
24 | // 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.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // 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.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // 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.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // 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.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_selected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "filename" : "common_icon_selected@2x.png",
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "filename" : "common_icon_selected@3x.png",
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "author" : "xcode",
20 | "version" : 1
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_selected.imageset/common_icon_selected@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/Example/UILabelImageText/Images.xcassets/common_icon_selected.imageset/common_icon_selected@2x.png
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_selected.imageset/common_icon_selected@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/Example/UILabelImageText/Images.xcassets/common_icon_selected.imageset/common_icon_selected@3x.png
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_unselected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "filename" : "common_icon_unselected@2x.png",
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "filename" : "common_icon_unselected@3x.png",
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "author" : "xcode",
20 | "version" : 1
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_unselected.imageset/common_icon_unselected@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/Example/UILabelImageText/Images.xcassets/common_icon_unselected.imageset/common_icon_unselected@2x.png
--------------------------------------------------------------------------------
/Example/UILabelImageText/Images.xcassets/common_icon_unselected.imageset/common_icon_unselected@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/Example/UILabelImageText/Images.xcassets/common_icon_unselected.imageset/common_icon_unselected@3x.png
--------------------------------------------------------------------------------
/Example/UILabelImageText/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 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Example/UILabelImageText/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // UILabelImageText
4 | //
5 | // Created by chenwuqi on 04/27/2023.
6 | // Copyright (c) 2023 chenwuqi. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import UILabelImageText
11 |
12 | class ViewController: UIViewController {
13 |
14 | @IBOutlet weak var agreeL: UILabel!
15 | override func viewDidLoad() {
16 | super.viewDidLoad()
17 | // Do any additional setup after loading the view, typically from a nib.
18 |
19 | agreeL.imageText(normalImage: UIImage(named: "common_icon_unselected"), selectedImage: UIImage(named: "common_icon_selected"), content: " 希望您勾选已阅读并同意《用户协议》和《隐私协议》希望您勾选已阅读并同意《用户协议》和《隐私协议》", font: UIFont.systemFont(ofSize: 12), largeFont: UIFont.systemFont(ofSize: 20), alignment: .left)
20 | agreeL.setImageCallBack {
21 | print("点击图标")
22 |
23 | }
24 |
25 | agreeL.setSubstringCallBack(substring: "《用户协议》") {
26 | print("《用户协议》")
27 | }
28 |
29 | agreeL.setSubstringCallBack(substring: "《隐私协议》") {
30 | print("《隐私协议》")
31 | }
32 | }
33 |
34 | override func didReceiveMemoryWarning() {
35 | super.didReceiveMemoryWarning()
36 | // Dispose of any resources that can be recreated.
37 | }
38 |
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2023 chenwuqi <925769607@qq.com>
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UILabelImageText
2 |
3 | [](https://travis-ci.org/chenwuqi/UILabelImageText)
4 | [](https://cocoapods.org/pods/UILabelImageText)
5 | [](https://cocoapods.org/pods/UILabelImageText)
6 | [](https://cocoapods.org/pods/UILabelImageText)
7 |
8 | ## Example
9 |
10 | To run the example project, clone the repo, and run `pod install` from the Example directory first.
11 |
12 | ## Requirements
13 |
14 | ## Installation
15 |
16 | UILabelImageText is available through [CocoaPods](https://cocoapods.org). To install
17 | it, simply add the following line to your Podfile:
18 |
19 | ```ruby
20 | pod 'UILabelImageText'
21 | ```
22 |
23 | ## Author
24 |
25 | chenwuqi, 925769607@qq.com
26 |
27 | ## License
28 |
29 | UILabelImageText is available under the MIT license. See the LICENSE file for more info.
30 |
--------------------------------------------------------------------------------
/UILabelImageText.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint UILabelImageText.podspec' to ensure this is a
3 | # valid spec before submitting.
4 | #
5 | # Any lines starting with a # are optional, but their use is encouraged
6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 | Pod::Spec.new do |s|
10 | s.name = 'UILabelImageText'
11 | s.version = '0.1.2'
12 | s.summary = 'Use UILabel to achieve image and text mixed layout, supporting click events.'
13 |
14 | # This description is used to generate tags and improve search results.
15 | # * Think: What does it do? Why did you write it? What is the focus?
16 | # * Try to keep it short, snappy and to the point.
17 | # * Write the description between the DESC delimiters below.
18 | # * Finally, don't worry about the indent, CocoaPods strips it!
19 |
20 | s.description = <<-DESC
21 | Suitable for the first icon following the text, the icon can be clicked,
22 | and some text can be specified to support clicking
23 | DESC
24 |
25 | s.homepage = 'https://github.com/chenaqi/UILabelImageText'
26 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
27 | s.license = { :type => 'MIT', :file => 'LICENSE' }
28 | s.author = { 'chenwuqi' => '925769607@qq.com' }
29 | s.source = { :git => 'https://github.com/chenaqi/UILabelImageText.git', :tag => s.version.to_s }
30 | # s.social_media_url = 'https://twitter.com/'
31 |
32 | s.ios.deployment_target = '11.0'
33 | s.swift_version = '4.0'
34 |
35 | s.source_files = 'UILabelImageText/Classes/**/*'
36 |
37 | # s.resource_bundles = {
38 | # 'UILabelImageText' => ['UILabelImageText/Assets/*.png']
39 | # }
40 |
41 | # s.public_header_files = 'Pod/Classes/**/*.h'
42 | s.frameworks = 'UIKit', 'Foundation'
43 | # s.dependency 'AFNetworking', '~> 2.3'
44 | end
45 |
--------------------------------------------------------------------------------
/UILabelImageText/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/UILabelImageText/Assets/.gitkeep
--------------------------------------------------------------------------------
/UILabelImageText/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenaqi/UILabelImageText/a8d505861ab88d66f15a97f1dd19c740e6929f30/UILabelImageText/Classes/.gitkeep
--------------------------------------------------------------------------------
/UILabelImageText/Classes/NSString+SubstringRange.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+SubstringRange.swift
3 | // UILabelImageText
4 | //
5 | // Created by 陈武琦 on 2023/4/27.
6 | //
7 |
8 | import Foundation
9 |
10 | extension NSString {
11 |
12 | func allRanges(substring: String) -> [NSRange]? {
13 | var ranges = [NSRange]()
14 | rangeOf(str: substring, ranges: &ranges, fromIndex: 0)
15 | if ranges.count > 0 {
16 | return ranges
17 | }
18 | return nil
19 | }
20 |
21 | func rangeOf(str: String, ranges:inout [NSRange], fromIndex: Int) {
22 | if fromIndex >= length - str.count {
23 | return
24 | }
25 |
26 | let subStringToSearch : NSString = substring(from: fromIndex) as NSString
27 | var stringRange = subStringToSearch.range(of: str)
28 |
29 | if (stringRange.location != NSNotFound)
30 | {
31 | stringRange.location += fromIndex
32 | ranges.append(stringRange)
33 | rangeOf(str: str, ranges: &ranges, fromIndex: stringRange.location + str.count)
34 | }
35 |
36 | }
37 |
38 |
39 | // //通过递归获取所有子字符串location
40 | // - (void)rangeOfString:(NSString*)searchString fatherString:(NSString*)fatherStr options:(NSStringCompareOptions)mask range:(NSRange)rangeOfReceiverToSearch {
41 | // //获取指定范围内第一个匹配的子字符串rang,和上面NSRegularExpression的一个方法效果一样NSRange rang = [fatherStr rangeOfString:searchString options:mask range:rangeOfReceiverToSearch];//判断搜寻范围来决定是否完成搜寻
42 | // if (rang.location >fatherStr.length - searchString.length) {
43 | // return;
44 | // }//NSRang不能存储在数组中,所以这里存的是rang的location
45 | // [strLocationRangArr addObject:[NSNumber numberWithInteger:rang.location]];//递归搜寻
46 | // [self rangeOfString:searchString fatherString:fatherStr options:mask range:NSMakeRange(rang.location+searchString.length, fatherStr.length-rang.location-searchString.length)];
47 | // }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/UILabelImageText/Classes/UILabel+ImageText.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel+ImageText.swift
3 | // ImageTextDemo
4 | //
5 | // Created by 陈武琦 on 2023/4/21.
6 | //
7 |
8 | import UIKit
9 |
10 | //MARK: 图文混排,支持点击事件
11 | /// 使用情况:图标可以选中,协议可以点击
12 | public extension UILabel {
13 | typealias CallBack = (() -> Void)
14 |
15 | private struct ImageTextKeys {
16 | static var imageSelected = "com.imageText-swift.imageSelected"
17 | static var normalImage = "com.imageText-swift.normalImage"
18 | static var selectedImage = "com.imageText-swift.selectedImage"
19 | static var callBackMap = "com.imageText-swift.callBackMap"
20 | static var normalImgAttrString = "com.imageText-swift.normalImgAttrString"
21 | static var selectedImgAttrString = "com.imageText-swift.selectedImgAttrString"
22 | static var paragraphStyle = "com.imageText-swift.paragraphStyle"
23 | static var largeFont = "com.imageText-swift.largeFont"
24 | static var normalFont = "com.imageText-swift.normalFont"
25 | }
26 |
27 |
28 | //图标选中状态
29 | var selected: Bool {
30 | get { return objc_getAssociatedObject(self, &ImageTextKeys.imageSelected) as? Bool ?? false }
31 |
32 | set {
33 |
34 | if newValue == selected {
35 | return
36 | }
37 |
38 | guard let textAttr = attributedText else {
39 | objc_setAssociatedObject(self, &ImageTextKeys.imageSelected, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC)
40 | return
41 | }
42 | let attributedString = textAttr.mutableCopy() as! NSMutableAttributedString
43 | if newValue {
44 | attributedString.replaceCharacters(in: NSRange(location: 0, length: normalImgAttrString.length), with: selectedImgAttrString)
45 | }else {
46 | attributedString.replaceCharacters(in: NSRange(location: 0, length: selectedImgAttrString.length), with: normalImgAttrString)
47 | }
48 | attributedText = attributedString
49 | configAttributes()
50 | objc_setAssociatedObject(self, &ImageTextKeys.imageSelected, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC)
51 |
52 | }
53 |
54 | }
55 |
56 | // 未选中图标
57 | private var normalImgAttrString: NSAttributedString {
58 | get { return objc_getAssociatedObject(self, &ImageTextKeys.normalImgAttrString) as? NSAttributedString ?? NSAttributedString()}
59 |
60 | set { objc_setAssociatedObject(self, &ImageTextKeys.normalImgAttrString, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) }
61 | }
62 |
63 | // 选中图标
64 | private var selectedImgAttrString: NSAttributedString {
65 | get { return objc_getAssociatedObject(self, &ImageTextKeys.selectedImgAttrString) as? NSAttributedString ?? NSAttributedString()}
66 |
67 | set {
68 | objc_setAssociatedObject(self, &ImageTextKeys.selectedImgAttrString, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
69 |
70 | }
71 | }
72 |
73 |
74 | private var paragraphStyle: NSMutableParagraphStyle {
75 | get { return objc_getAssociatedObject(self, &ImageTextKeys.paragraphStyle) as? NSMutableParagraphStyle ?? NSMutableParagraphStyle()}
76 |
77 | set {
78 | objc_setAssociatedObject(self, &ImageTextKeys.paragraphStyle, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
79 |
80 | }
81 | }
82 |
83 | private var largeFont: UIFont {
84 | get { return objc_getAssociatedObject(self, &ImageTextKeys.largeFont) as? UIFont ?? UIFont.systemFont(ofSize: 20)}
85 |
86 | set {
87 | objc_setAssociatedObject(self, &ImageTextKeys.largeFont, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
88 |
89 | }
90 | }
91 |
92 | private var normalFont: UIFont {
93 | get { return objc_getAssociatedObject(self, &ImageTextKeys.normalFont) as? UIFont ?? UIFont.systemFont(ofSize: 12)}
94 |
95 | set {
96 | objc_setAssociatedObject(self, &ImageTextKeys.normalFont, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
97 |
98 | }
99 | }
100 |
101 |
102 |
103 | private var callBackMap: [String:CallBack]? {
104 | get { return objc_getAssociatedObject(self, &ImageTextKeys.callBackMap) as? [String:CallBack] ?? [String:CallBack]()}
105 |
106 | set { objc_setAssociatedObject(self, &ImageTextKeys.callBackMap, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC) }
107 | }
108 |
109 |
110 | func imageText(normalImage: UIImage? = nil,
111 | selectedImage: UIImage? = nil,
112 | content: String? = nil,
113 | font: UIFont = UIFont.systemFont(ofSize: 12),
114 | largeFont: UIFont = UIFont.systemFont(ofSize: 20),
115 | alignment: NSTextAlignment = .left) {
116 |
117 | if normalImage == nil && selectedImage == nil && content == nil {
118 | assert(true, "参数全为空")
119 | }
120 |
121 | let muAttributedString = NSMutableAttributedString()
122 |
123 | if let normalImage = normalImage {
124 | let attachment = NSTextAttachment()
125 | attachment.image = normalImage
126 | normalImgAttrString = NSAttributedString(attachment: attachment)
127 | muAttributedString.append(normalImgAttrString)
128 | }
129 |
130 | if let selectedImage = selectedImage {
131 | let attachment = NSTextAttachment()
132 | attachment.image = selectedImage
133 | selectedImgAttrString = NSAttributedString(attachment: attachment)
134 | }
135 |
136 | if let content = content {
137 | muAttributedString.append(NSAttributedString(string: content))
138 | }
139 |
140 | self.normalFont = font
141 | self.largeFont = largeFont
142 | paragraphStyle.alignment = alignment
143 | attributedText = muAttributedString
144 | configAttributes()
145 | addGesture()
146 |
147 | }
148 |
149 |
150 |
151 | func setImageCallBack(clicked: @escaping () -> Void) {
152 | callBackMap?[normalImgAttrString.string] = clicked
153 | callBackMap?[selectedImgAttrString.string] = clicked
154 | }
155 |
156 | func setSubstringCallBack(substring: String, color: UIColor = .gray, clicked: @escaping () -> Void) {
157 | guard let textAttr = attributedText else {
158 | return
159 | }
160 |
161 | let ranges = textAttr.string.allRanges(substring: substring) ?? nil
162 | let attributedString = textAttr.mutableCopy() as! NSMutableAttributedString
163 | if ranges != nil {
164 | for range in ranges! {
165 | attributedString.addAttributes([NSAttributedString.Key.foregroundColor: color], range: range)
166 | attributedText = attributedString
167 | callBackMap?[substring] = clicked
168 | }
169 | }
170 | }
171 |
172 |
173 | // 段落设置
174 | private func configAttributes() {
175 | guard let textAttr = attributedText else {
176 | return
177 | }
178 |
179 | let muAttributedString = textAttr.mutableCopy() as! NSMutableAttributedString
180 |
181 | muAttributedString.addAttributes([NSAttributedString.Key.paragraphStyle: paragraphStyle,
182 | NSAttributedString.Key.font: normalFont],
183 | range: NSRange(location: 0, length: muAttributedString.length))
184 |
185 | if normalImgAttrString.length > 0 {
186 |
187 | //适用于图片的大小等于点击区域
188 | // let baselineOffset = (largeFont.lineHeight - normalFont.lineHeight)/2.0
189 | //适用于图片的小于点击区域
190 | let baselineOffset = (largeFont.lineHeight - normalFont.lineHeight)/2.0 + (largeFont.descender - normalFont.descender)
191 | muAttributedString.addAttributes([
192 | NSAttributedString.Key.baselineOffset: baselineOffset],
193 | range: NSRange(location: normalImgAttrString.length, length: muAttributedString.length - normalImgAttrString.length))
194 |
195 | }else {
196 | muAttributedString.addAttributes([NSAttributedString.Key.font: normalFont],
197 | range: NSRange(location: 0, length: muAttributedString.length))
198 | }
199 |
200 | attributedText = muAttributedString
201 | }
202 |
203 |
204 | //添加点击手势
205 | private func addGesture() {
206 | let tapGesture = UITapGestureRecognizer()
207 | self.isUserInteractionEnabled = true
208 | self.addGestureRecognizer(tapGesture)
209 | tapGesture.addTarget(self, action: #selector(click))
210 | }
211 |
212 |
213 | // 点击响应
214 | @objc
215 | private func click(_ gesture: UITapGestureRecognizer) {
216 |
217 | guard let dict = callBackMap else {
218 | return
219 | }
220 |
221 | let point = gesture.location(in: self)
222 | for key in dict.keys {
223 | guard let textAttr = attributedText else {
224 | return
225 | }
226 | let ranges = textAttr.string.allRanges(substring: key) ?? nil
227 | if ranges != nil {
228 | for range in ranges! {
229 | guard let (rect1, rect2) = rectFor(string: key, stringRange: range) else {
230 | return
231 | }
232 | let imgString = selected ? selectedImgAttrString : normalImgAttrString
233 |
234 | if containsPoint(minRect: rect1, maxRect: key == imgString.string ? CGRect(x: 0, y: 0, width: largeFont.pointSize, height: largeFont.pointSize):rect2, point: point) {
235 |
236 | if key == imgString.string {
237 | selected = !selected
238 | }
239 | if let callBack = dict[key] {
240 | callBack()
241 | }
242 | }
243 | }
244 | }
245 | }
246 | }
247 |
248 | private func containsPoint(minRect:CGRect, maxRect: CGRect, point: CGPoint) -> Bool {
249 | let midHeight = maxRect.minY - minRect.maxY > 0 ? maxRect.minY - minRect.maxY : 0
250 | let midRect = CGRect(x: 0, y: minRect.maxY, width: bounds.width, height: midHeight)
251 | return minRect.contains(point) ||
252 | midRect.contains(point) ||
253 | maxRect.contains(point)
254 | }
255 |
256 | }
257 |
258 | extension UILabel
259 | {
260 | // 查找字串的rect
261 | func rectFor(string str : String, stringRange: NSRange) -> (CGRect, CGRect)?
262 | {
263 | // Find the range of the string
264 | guard self.text != nil else { return nil }
265 | if (stringRange.location != NSNotFound)
266 | {
267 | guard self.attributedText != nil else { return nil }
268 | // Add the starting point to the sub string
269 | let storage = NSTextStorage(attributedString: self.attributedText!)
270 | let layoutManager = NSLayoutManager()
271 | storage.addLayoutManager(layoutManager)
272 | let textContainer = NSTextContainer(size: self.frame.size)
273 | textContainer.lineFragmentPadding = 0
274 | textContainer.lineBreakMode = .byWordWrapping
275 | layoutManager.addTextContainer(textContainer)
276 | var glyphRange = NSRange()
277 |
278 | layoutManager.characterRange(forGlyphRange: stringRange, actualGlyphRange: &glyphRange)
279 | var firstWordRect = true
280 | var rect1 = CGRectZero
281 | var rect2 = CGRectZero
282 | layoutManager.enumerateEnclosingRects(forGlyphRange: glyphRange, withinSelectedGlyphRange: NSRange(location: NSNotFound, length: 1), in: textContainer) { wordRect, isStop in
283 | print("_____wordRect:\(wordRect)")
284 | if firstWordRect {
285 | rect1 = wordRect
286 | firstWordRect = false
287 | }
288 |
289 | rect2 = wordRect
290 | }
291 |
292 | return (rect1, rect2)
293 | }
294 | return nil
295 | }
296 | }
297 |
298 |
299 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------