├── .gitignore ├── LICENSE ├── README.md └── 常用知识点汇总 ├── 常用知识点汇总.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── 常用知识点汇总 ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Content.h ├── Content.m ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOSknowledgeGather 2 | iOS之常用知识点汇总 3 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FF7BF8331D2254DA006C7E19 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FF7BF8321D2254DA006C7E19 /* main.m */; }; 11 | FF7BF8361D2254DA006C7E19 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FF7BF8351D2254DA006C7E19 /* AppDelegate.m */; }; 12 | FF7BF8391D2254DA006C7E19 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF7BF8381D2254DA006C7E19 /* ViewController.m */; }; 13 | FF7BF83C1D2254DB006C7E19 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FF7BF83A1D2254DB006C7E19 /* Main.storyboard */; }; 14 | FF7BF83E1D2254DB006C7E19 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FF7BF83D1D2254DB006C7E19 /* Assets.xcassets */; }; 15 | FF7BF8411D2254DB006C7E19 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FF7BF83F1D2254DB006C7E19 /* LaunchScreen.storyboard */; }; 16 | FF7BF84B1D225637006C7E19 /* Content.m in Sources */ = {isa = PBXBuildFile; fileRef = FF7BF84A1D225637006C7E19 /* Content.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | FF7BF82E1D2254DA006C7E19 /* 常用知识点汇总.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "常用知识点汇总.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | FF7BF8321D2254DA006C7E19 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | FF7BF8341D2254DA006C7E19 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../AppDelegate.h; sourceTree = ""; }; 23 | FF7BF8351D2254DA006C7E19 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ../AppDelegate.m; sourceTree = ""; }; 24 | FF7BF8371D2254DA006C7E19 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = ../ViewController.h; sourceTree = ""; }; 25 | FF7BF8381D2254DA006C7E19 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = ../ViewController.m; sourceTree = ""; }; 26 | FF7BF83B1D2254DB006C7E19 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | FF7BF83D1D2254DB006C7E19 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../Assets.xcassets; sourceTree = ""; }; 28 | FF7BF8401D2254DB006C7E19 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | FF7BF8421D2254DB006C7E19 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; 30 | FF7BF8491D225637006C7E19 /* Content.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Content.h; sourceTree = ""; }; 31 | FF7BF84A1D225637006C7E19 /* Content.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Content.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | FF7BF82B1D2254DA006C7E19 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | FF7BF8251D2254DA006C7E19 = { 46 | isa = PBXGroup; 47 | children = ( 48 | FF7BF8301D2254DA006C7E19 /* 常用知识点汇总 */, 49 | FF7BF82F1D2254DA006C7E19 /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | FF7BF82F1D2254DA006C7E19 /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | FF7BF82E1D2254DA006C7E19 /* 常用知识点汇总.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | FF7BF8301D2254DA006C7E19 /* 常用知识点汇总 */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | FF7BF8491D225637006C7E19 /* Content.h */, 65 | FF7BF84A1D225637006C7E19 /* Content.m */, 66 | FF7BF8481D2255FF006C7E19 /* systemFile */, 67 | FF7BF8311D2254DA006C7E19 /* Supporting Files */, 68 | ); 69 | path = "常用知识点汇总"; 70 | sourceTree = ""; 71 | }; 72 | FF7BF8311D2254DA006C7E19 /* Supporting Files */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | FF7BF8321D2254DA006C7E19 /* main.m */, 76 | ); 77 | name = "Supporting Files"; 78 | sourceTree = ""; 79 | }; 80 | FF7BF8481D2255FF006C7E19 /* systemFile */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | FF7BF8341D2254DA006C7E19 /* AppDelegate.h */, 84 | FF7BF8351D2254DA006C7E19 /* AppDelegate.m */, 85 | FF7BF8371D2254DA006C7E19 /* ViewController.h */, 86 | FF7BF8381D2254DA006C7E19 /* ViewController.m */, 87 | FF7BF83A1D2254DB006C7E19 /* Main.storyboard */, 88 | FF7BF83D1D2254DB006C7E19 /* Assets.xcassets */, 89 | FF7BF83F1D2254DB006C7E19 /* LaunchScreen.storyboard */, 90 | FF7BF8421D2254DB006C7E19 /* Info.plist */, 91 | ); 92 | path = systemFile; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | FF7BF82D1D2254DA006C7E19 /* 常用知识点汇总 */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = FF7BF8451D2254DB006C7E19 /* Build configuration list for PBXNativeTarget "常用知识点汇总" */; 101 | buildPhases = ( 102 | FF7BF82A1D2254DA006C7E19 /* Sources */, 103 | FF7BF82B1D2254DA006C7E19 /* Frameworks */, 104 | FF7BF82C1D2254DA006C7E19 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = "常用知识点汇总"; 111 | productName = "常用知识点汇总"; 112 | productReference = FF7BF82E1D2254DA006C7E19 /* 常用知识点汇总.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | FF7BF8261D2254DA006C7E19 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0730; 122 | ORGANIZATIONNAME = Lee; 123 | TargetAttributes = { 124 | FF7BF82D1D2254DA006C7E19 = { 125 | CreatedOnToolsVersion = 7.3.1; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = FF7BF8291D2254DA006C7E19 /* Build configuration list for PBXProject "常用知识点汇总" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = FF7BF8251D2254DA006C7E19; 138 | productRefGroup = FF7BF82F1D2254DA006C7E19 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | FF7BF82D1D2254DA006C7E19 /* 常用知识点汇总 */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | FF7BF82C1D2254DA006C7E19 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | FF7BF8411D2254DB006C7E19 /* LaunchScreen.storyboard in Resources */, 153 | FF7BF83E1D2254DB006C7E19 /* Assets.xcassets in Resources */, 154 | FF7BF83C1D2254DB006C7E19 /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | FF7BF82A1D2254DA006C7E19 /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | FF7BF8391D2254DA006C7E19 /* ViewController.m in Sources */, 166 | FF7BF8361D2254DA006C7E19 /* AppDelegate.m in Sources */, 167 | FF7BF8331D2254DA006C7E19 /* main.m in Sources */, 168 | FF7BF84B1D225637006C7E19 /* Content.m in Sources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXSourcesBuildPhase section */ 173 | 174 | /* Begin PBXVariantGroup section */ 175 | FF7BF83A1D2254DB006C7E19 /* Main.storyboard */ = { 176 | isa = PBXVariantGroup; 177 | children = ( 178 | FF7BF83B1D2254DB006C7E19 /* Base */, 179 | ); 180 | name = Main.storyboard; 181 | path = ..; 182 | sourceTree = ""; 183 | }; 184 | FF7BF83F1D2254DB006C7E19 /* LaunchScreen.storyboard */ = { 185 | isa = PBXVariantGroup; 186 | children = ( 187 | FF7BF8401D2254DB006C7E19 /* Base */, 188 | ); 189 | name = LaunchScreen.storyboard; 190 | path = ..; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | FF7BF8431D2254DB006C7E19 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_NONNULL = YES; 201 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 202 | CLANG_CXX_LIBRARY = "libc++"; 203 | CLANG_ENABLE_MODULES = YES; 204 | CLANG_ENABLE_OBJC_ARC = YES; 205 | CLANG_WARN_BOOL_CONVERSION = YES; 206 | CLANG_WARN_CONSTANT_CONVERSION = YES; 207 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 208 | CLANG_WARN_EMPTY_BODY = YES; 209 | CLANG_WARN_ENUM_CONVERSION = YES; 210 | CLANG_WARN_INT_CONVERSION = YES; 211 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 212 | CLANG_WARN_UNREACHABLE_CODE = YES; 213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 214 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 215 | COPY_PHASE_STRIP = NO; 216 | DEBUG_INFORMATION_FORMAT = dwarf; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | ENABLE_TESTABILITY = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu99; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 234 | MTL_ENABLE_DEBUG_INFO = YES; 235 | ONLY_ACTIVE_ARCH = YES; 236 | SDKROOT = iphoneos; 237 | TARGETED_DEVICE_FAMILY = "1,2"; 238 | }; 239 | name = Debug; 240 | }; 241 | FF7BF8441D2254DB006C7E19 /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_UNREACHABLE_CODE = YES; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 260 | COPY_PHASE_STRIP = NO; 261 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 262 | ENABLE_NS_ASSERTIONS = NO; 263 | ENABLE_STRICT_OBJC_MSGSEND = YES; 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_NO_COMMON_BLOCKS = YES; 266 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 267 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 268 | GCC_WARN_UNDECLARED_SELECTOR = YES; 269 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 270 | GCC_WARN_UNUSED_FUNCTION = YES; 271 | GCC_WARN_UNUSED_VARIABLE = YES; 272 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 273 | MTL_ENABLE_DEBUG_INFO = NO; 274 | SDKROOT = iphoneos; 275 | TARGETED_DEVICE_FAMILY = "1,2"; 276 | VALIDATE_PRODUCT = YES; 277 | }; 278 | name = Release; 279 | }; 280 | FF7BF8461D2254DB006C7E19 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 284 | INFOPLIST_FILE = "常用知识点汇总/Info.plist"; 285 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 286 | PRODUCT_BUNDLE_IDENTIFIER = "lixiao.-------"; 287 | PRODUCT_NAME = "$(TARGET_NAME)"; 288 | }; 289 | name = Debug; 290 | }; 291 | FF7BF8471D2254DB006C7E19 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | INFOPLIST_FILE = "常用知识点汇总/Info.plist"; 296 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 297 | PRODUCT_BUNDLE_IDENTIFIER = "lixiao.-------"; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | }; 300 | name = Release; 301 | }; 302 | /* End XCBuildConfiguration section */ 303 | 304 | /* Begin XCConfigurationList section */ 305 | FF7BF8291D2254DA006C7E19 /* Build configuration list for PBXProject "常用知识点汇总" */ = { 306 | isa = XCConfigurationList; 307 | buildConfigurations = ( 308 | FF7BF8431D2254DB006C7E19 /* Debug */, 309 | FF7BF8441D2254DB006C7E19 /* Release */, 310 | ); 311 | defaultConfigurationIsVisible = 0; 312 | defaultConfigurationName = Release; 313 | }; 314 | FF7BF8451D2254DB006C7E19 /* Build configuration list for PBXNativeTarget "常用知识点汇总" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | FF7BF8461D2254DB006C7E19 /* Debug */, 318 | FF7BF8471D2254DB006C7E19 /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | }; 322 | /* End XCConfigurationList section */ 323 | }; 324 | rootObject = FF7BF8261D2254DA006C7E19 /* Project object */; 325 | } 326 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 常用知识点汇总 4 | // 5 | // Created by 祥云创想 on 16/6/28. 6 | // Copyright © 2016年 Lee. 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 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 常用知识点汇总 4 | // 5 | // Created by 祥云创想 on 16/6/28. 6 | // Copyright © 2016年 Lee. 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 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/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 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/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 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/Content.h: -------------------------------------------------------------------------------- 1 | // 2 | // Content.h 3 | // 常用知识点汇总 4 | 5 | 6 | #import 7 | #import 8 | @interface Content : NSObject 9 | /* 10 | 1.NSString过滤特殊字符 11 | 2.TransForm属性 12 | 3.计算方法耗时时间间隔 13 | 4.Alert提示宏定义 14 | 5.让iOS应用直接退出 15 | 6.快速求总和 最大值 最小值 和 平均值 16 | 7.修改Label中不同文字颜色 17 | 8.Label行间距 18 | 9.UIImageView填充模式 19 | 10.iOS 开发中一些相关的路径 20 | 11.关于隐藏navigationbar 21 | 12.自动处理键盘事件,实现输入框防遮挡的插件 22 | 13.设置字体和行间距 23 | 14.点击button倒计时 24 | 15.修改textFieldplaceholder字体颜色和大小 25 | 16.图片拉伸 26 | 17.去掉导航栏下边的黑线 27 | 18.修改pagecontrol颜色 28 | 19.去掉UITableView的section的粘性,使其不会悬停 29 | 20.UIImage与字符串互转 30 | 21.判断NSString中是否包含中文 31 | 22.NSDate与NSString的相互转化 32 | 23.控件的局部圆角 33 | 24.navigationBar的透明问题 34 | 25.全局设置navigationBar标题的样式和barItem的标题样式 35 | 26.侧滑手势返回 36 | 27.给webView添加头视图 37 | 28.模态跳转的动画设置 38 | 29.图片处理只拿到图片的一部分 39 | 30.给UIView设置图片 40 | 31.给TableView或者CollectionView的cell添加简单动画 41 | 32.线程中更新 UILabel的text 42 | 33.获得当前硬盘空间 43 | 34.ActivityViewController 使用AirDrop分享 44 | 35.保存全屏为image 45 | 36.获取通讯录联系人的电话号码 46 | 37.用WebView加载页面,提前获取页面的高度 47 | */ 48 | @end 49 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/Content.m: -------------------------------------------------------------------------------- 1 | // 2 | // Content.m 3 | // 常用知识点汇总 4 | 5 | 6 | #import "Content.h" 7 | 8 | @implementation Content 9 | 10 | #pragma 1.NSString过滤特殊字符 11 | // 定义一个特殊字符的集合 12 | NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString: 13 | @"@/:;()¥「」"、[]{}#%-*+=_\\|~<>$€^•'@#$%^&*()_+'\""]; 14 | // 过滤字符串的特殊字符 15 | NSString *newString = [NSString stringByTrimmingCharactersInSet:set]; 16 | 17 | 18 | #pragma 2.TransForm属性 19 | //平移按钮 20 | CGAffineTransform transForm = self.buttonView.transform; 21 | self.buttonView.transform = CGAffineTransformTranslate(transForm, 10, 0); 22 | 23 | //旋转按钮 24 | CGAffineTransform transForm = self.buttonView.transform; 25 | self.buttonView.transform = CGAffineTransformRotate(transForm, M_PI_4); 26 | 27 | //缩放按钮 28 | self.buttonView.transform = CGAffineTransformScale(transForm, 1.2, 1.2); 29 | 30 | //初始化复位 31 | self.buttonView.transform = CGAffineTransformIdentity; 32 | 33 | #pragma 3.计算方法耗时时间间隔 34 | // 获取时间间隔 35 | #define TICK CFAbsoluteTime start = CFAbsoluteTimeGetCurrent(); 36 | #define TOCK NSLog(@"Time: %f", CFAbsoluteTimeGetCurrent() - start) 37 | 38 | 39 | #pragma 4.Alert提示宏定义 40 | //Alert提示宏定义 41 | #define Alert(_S_, …) [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show] 42 | 43 | #pragma 5.让iOS应用直接退出 44 | - (void)exitApplication { 45 | AppDelegate *app = [UIApplication sharedApplication].delegate; 46 | UIWindow *window = app.window; 47 | 48 | [UIView animateWithDuration:1.0f animations:^{ 49 | window.alpha = 0; 50 | } completion:^(BOOL finished) { 51 | exit(0); 52 | }]; 53 | } 54 | 55 | #pragma 6.快速求总和 最大值 最小值 和 平均值 56 | NSArray 快速求总和 最大值 最小值 和 平均值 57 | NSArray *array = [NSArray arrayWithObjects:@"2.0", @"2.3", @"3.0", @"4.0", @"10", nil]; 58 | CGFloat sum = [[array valueForKeyPath:@"@sum.floatValue"] floatValue]; 59 | CGFloat avg = [[array valueForKeyPath:@"@avg.floatValue"] floatValue]; 60 | CGFloat max =[[array valueForKeyPath:@"@max.floatValue"] floatValue]; 61 | CGFloat min =[[array valueForKeyPath:@"@min.floatValue"] floatValue]; 62 | NSLog(@"%f\n%f\n%f\n%f",sum,avg,max,min); 63 | 64 | #pragma 7.修改Label中不同文字颜色 65 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 66 | { 67 | [self editStringColor:self.label.text editStr:@"好" color:[UIColor blueColor]]; 68 | } 69 | 70 | - (void)editStringColor:(NSString *)string editStr:(NSString *)editStr color:(UIColor *)color { 71 | // string为整体字符串, editStr为需要修改的字符串 72 | NSRange range = [string rangeOfString:editStr]; 73 | 74 | NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:string]; 75 | 76 | // 设置属性修改字体颜色UIColor与大小UIFont 77 | [attribute addAttributes:@{NSForegroundColorAttributeName:color} range:range]; 78 | 79 | self.label.attributedText = attribute; 80 | } 81 | #pragma 8.Label行间距 82 | 83 | -(void)test{ 84 | NSMutableAttributedString *attributedString = 85 | [[NSMutableAttributedString alloc] initWithString:self.contentLabel.text]; 86 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; 87 | [paragraphStyle setLineSpacing:3]; 88 | 89 | //调整行间距 90 | [attributedString addAttribute:NSParagraphStyleAttributeName 91 | value:paragraphStyle 92 | range:NSMakeRange(0, [self.contentLabel.text length])]; 93 | self.contentLabel.attributedText = attributedString; 94 | } 95 | 96 | #pragma 9.UIImageView填充模式 97 | @"UIViewContentModeScaleToFill", // 拉伸自适应填满整个视图 98 | @"UIViewContentModeScaleAspectFit", // 自适应比例大小显示 99 | @"UIViewContentModeScaleAspectFill", // 原始大小显示 100 | @"UIViewContentModeRedraw", // 尺寸改变时重绘 101 | @"UIViewContentModeCenter", // 中间 102 | @"UIViewContentModeTop", // 顶部 103 | @"UIViewContentModeBottom", // 底部 104 | @"UIViewContentModeLeft", // 中间贴左 105 | @"UIViewContentModeRight", // 中间贴右 106 | @"UIViewContentModeTopLeft", // 贴左上 107 | @"UIViewContentModeTopRight", // 贴右上 108 | @"UIViewContentModeBottomLeft", // 贴左下 109 | @"UIViewContentModeBottomRight", // 贴右下 110 | 111 | #pragma 10.iOS 开发中一些相关的路径 112 | 模拟器的位置: 113 | /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs 114 | 115 | 文档安装位置: 116 | /Applications/Xcode.app/Contents/Developer/Documentation/DocSets 117 | 118 | 插件保存路径: 119 | ~/Library/ApplicationSupport/Developer/Shared/Xcode/Plug-ins 120 | 121 | 自定义代码段的保存路径: 122 | ~/Library/Developer/Xcode/UserData/CodeSnippets/ 123 | 如果找不到CodeSnippets文件夹,可以自己新建一个CodeSnippets文件夹。 124 | 125 | 证书路径 126 | ~/Library/MobileDevice/Provisioning Profiles 127 | 获取 iOS 路径的方法 128 | 获取家目录路径的函数 129 | NSString *homeDir = NSHomeDirectory(); 130 | 131 | 获取Documents目录路径的方法 132 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 133 | NSString *docDir = [paths objectAtIndex:0]; 134 | 135 | 获取Documents目录路径的方法 136 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 137 | NSString *cachesDir = [paths objectAtIndex:0]; 138 | 139 | 获取tmp目录路径的方法: 140 | NSString *tmpDir = NSTemporaryDirectory(); 141 | 142 | #pragma 11.关于隐藏navigationbar 143 | 设置滑动的时候隐藏navigationbar 144 | navigationController.hidesBarsOnSwipe = Yes 145 | 动态隐藏NavigationBar 146 | //1.当我们的手离开屏幕时候隐藏 147 | - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset 148 | { 149 | if(velocity.y > 0) 150 | { 151 | [self.navigationController setNavigationBarHidden:YES animated:YES]; 152 | } else { 153 | [self.navigationController setNavigationBarHidden:NO animated:YES]; 154 | } 155 | } 156 | velocity.y这个量,在上滑和下滑时,变化极小(小数),但是因为方向不同,有正负之分,这就很好处理了。 157 | //2.在滑动过程中隐藏 158 | //像safari 159 | (1) 160 | self.navigationController.hidesBarsOnSwipe = YES; 161 | (2) 162 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 163 | { 164 | CGFloat offsetY = scrollView.contentOffset.y + __tableView.contentInset.top; 165 | CGFloat panTranslationY = [scrollView.panGestureRecognizer translationInView:self.tableView].y; 166 | if (offsetY > 64) { 167 | if (panTranslationY > 0) 168 | { 169 | //下滑趋势,显示 170 | [self.navigationController setNavigationBarHidden:NO animated:YES]; 171 | } else { 172 | //上滑趋势,隐藏 173 | [self.navigationController setNavigationBarHidden:YES animated:YES]; 174 | } 175 | } else { 176 | [self.navigationController setNavigationBarHidden:NO animated:YES]; 177 | } 178 | } 179 | 这里的offsetY > 64只是为了在视图滑过navigationBar的高度之后才开始处理,防止影响展示效果。panTranslationY是scrollView的pan手势的手指位置的y值,可能不是太好,因为panTranslationY这个值在较小幅度上下滑动时,可能都为正或都为负,这就使得这一方式不太灵敏. 180 | 181 | #pragma 12.自动处理键盘事件,实现输入框防遮挡的插件 182 | IQKeyboardManager 183 | https://github.com/hackiftekhar/IQKeyboardManager 184 | 185 | 186 | #pragma 13.设置字体和行间距 187 | //设置字体和行间距 188 | UILabel * lable = [[UILabel alloc]initWithFrame:CGRectMake(50, 100, 300, 200)]; 189 | lable.text = @"大家好,我是xiao公子,在这里我们一起学习新的知识,总结我们遇到的那些坑,共同的学习,共同的进步,共同的努力,只为美好的明天!!!有问题一起相互的探讨—123456!!!"; 190 | lable.numberOfLines = 0; 191 | lable.font = [UIFont systemFontOfSize:12]; 192 | lable.backgroundColor = [UIColor grayColor]; 193 | [self.view addSubview:lable]; 194 | //设置每个字体之间的间距 195 | //NSKernAttributeName 这个对象所对应的值是一个NSNumber对象(包含小数),作用是修改默认字体之间的距离调整,值为0的话表示字距调整是禁用的; NSMutableAttributedString * str = [[NSMutableAttributedString alloc]initWithString:lable.text attributes:@{NSKernAttributeName:@(5.0)}]; 196 | //设置某写字体的颜色 197 | //NSForegroundColorAttributeName 设置字体颜色 198 | NSRange blueRange = NSMakeRange([[str string] rangeOfString:@"xiao公子"].location, [[str string] rangeOfString:@"Frank_chun"].length); 199 | [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:blueRange]; 200 | NSRange blueRange1 = NSMakeRange([[str string] rangeOfString:@"123456"].location, [[str string] rangeOfString:@"438637472"].length); 201 | [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:blueRange1]; 202 | //设置每行之间的间距 203 | //NSParagraphStyleAttributeName 设置段落的样式 204 | NSMutableParagraphStyle * par = [[NSMutableParagraphStyle alloc]init]; 205 | [par setLineSpacing:20]; 206 | //为某一范围内文字添加某个属性 207 | //NSMakeRange表示所要的范围,从0到整个文本的长度 208 | [str addAttribute:NSParagraphStyleAttributeName value:par range:NSMakeRange(0, lable.text.length)]; [lable setAttributedText:str]; 209 | 210 | 211 | #pragma 14.点击button倒计时 212 | //第一种方法 213 | //点击button倒计时 214 | #import "ViewController.h" 215 | @interface ViewController () 216 | @property (nonatomic, strong) UIButton * timeButton; 217 | @property (nonatomic, strong) NSTimer * timer; 218 | @property (nonatomic, strong)UIButton * btn; 219 | @end@implementation ViewController 220 | { 221 | NSInteger _time; 222 | } 223 | - (void)viewDidLoad { 224 | [super viewDidLoad]; 225 | _time = 5; 226 | self.btn = [UIButton buttonWithType:UIButtonTypeCustom]; _btn.backgroundColor = [UIColor orangeColor]; 227 | [_btn setTitle:@"获取验证码" forState:UIControlStateNormal]; _btn.titleLabel.font = [UIFont systemFontOfSize:15]; 228 | [_timeButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 229 | [_btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside]; 230 | [self refreshButtonWidth]; 231 | [self.view addSubview:self.btn]; 232 | } 233 | - (void)refreshButtonWidth{ 234 | CGFloat width = 0; 235 | if (_btn.enabled){ 236 | width = 100; 237 | } else { 238 | width = 200; 239 | } 240 | _btn.center = CGPointMake(self.view.frame.size.width/2, 200); 241 | _btn.bounds = CGRectMake(0, 0, width, 40); 242 | //每次刷新,保证区域正确 243 | [_btn setBackgroundImage:[self imageWithColor:[UIColor orangeColor] andSize:_btn.frame.size] forState:UIControlStateNormal]; 244 | [_btn setBackgroundImage:[self imageWithColor:[UIColor lightGrayColor] andSize:_btn.frame.size] forState:UIControlStateDisabled]; 245 | } 246 | - (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)aSize{ 247 | CGRect rect = CGRectMake(0.0f, 0.0f, aSize.width, aSize.height); UIGraphicsBeginImageContext(rect.size); 248 | CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); 249 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 250 | return image; 251 | } 252 | - (void)btnAction:(UIButton *)sender{ 253 | sender.enabled = NO; 254 | [self refreshButtonWidth]; 255 | [sender setTitle:[NSString stringWithFormat:@"获取验证码(%zi)", _time] forState:UIControlStateNormal]; 256 | _timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(timeDown) userInfo:nil repeats:YES]; 257 | } 258 | - (void)timeDown{ 259 | _time —; 260 | if (_time == 0) { 261 | [_btn setTitle:@"重新获取" forState:UIControlStateNormal]; _btn.enabled = YES; 262 | [self refreshButtonWidth]; 263 | [_timer invalidate]; 264 | _timer = nil; 265 | _time = 5 ; 266 | return; 267 | } 268 | [_btn setTitle:[NSString stringWithFormat:@"获取验证码(%zi)", _time] forState:UIControlStateNormal]; 269 | } 270 | //第二种方法 271 | #pragma mark -点击发送验证码 272 | - (void)sendMessage:(UIButton *)btn{ 273 | if (self.phoneField.text.length == 0) { 274 | [self remindMessage:@"请输入正确的手机号"]; 275 | }else{ 276 | __block int timeout=60; 277 | //倒计时时间 278 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); 279 | //每秒执行 280 | dispatch_source_set_event_handler(_timer, ^{ 281 | if(timeout<=0){ 282 | //倒计时结束,关闭 283 | dispatch_source_cancel(_timer); dispatch_async(dispatch_get_main_queue(), ^{ 284 | // 设置界面的按钮显示 根据自己需求设置 285 | [btn setTitle:@"发送验证码" forState:UIControlStateNormal]; btn.userInteractionEnabled = YES; 286 | }); 287 | }else{ 288 | int seconds = timeout % 60; 289 | NSString *strTime = [NSString stringWithFormat:@"%d", seconds]; 290 | if ([strTime isEqualToString:@"0"]) { 291 | strTime = [NSString stringWithFormat:@"%d",60]; 292 | } 293 | dispatch_async(dispatch_get_main_queue(), ^{ 294 | //设置界面的按钮显示 根据自己需求设置 295 | //NSLog(@"____%@",strTime); 296 | [UIView beginAnimations:nil context:nil]; 297 | [UIView setAnimationDuration:1]; 298 | [btn setTitle:[NSString stringWithFormat:@"%@秒后重新发送",strTime] forState:UIControlStateNormal]; 299 | [UIView commitAnimations]; 300 | btn.userInteractionEnabled = NO; 301 | }); 302 | timeout—; 303 | } 304 | }); 305 | dispatch_resume(_timer); 306 | } 307 | #pragma 15.修改textFieldplaceholder字体颜色和大小 308 | textField.placeholder = @"username is in here!"; [/p][textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; 309 | [textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"]; 310 | #pragma 16.图片拉伸 311 | UIImage* img=[UIImage imageNamed:@"2.png"];//原图 312 | UIEdgeInsets edge=UIEdgeInsetsMake(0, 10, 0,10); 313 | //UIImageResizingModeStretch:拉伸模式,通过拉伸UIEdgeInsets指定的矩形区域来填充图片 314 | //UIImageResizingModeTile:平铺模式,通过重复显示UIEdgeInsets指定的矩形区域来填充图 315 | img= [img resizableImageWithCapInsets:edge resizingMode:UIImageResizingModeStretch]; 316 | self.imageView.image=img; 317 | #pragma 17.去掉导航栏下边的黑线 318 | [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; 319 | self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init]; 320 | #pragma 18.修改pagecontrol颜色 321 | _pageControl.currentPageIndicatorTintColor=SFQRedColor; 322 | _pageControl.pageIndicatorTintColor=SFQGrayColor; 323 | #pragma 19.去掉UITableView的section的粘性,使其不会悬停 324 | //有时候使用UITableView所实现的列表,会使用到section,但是又不希望它粘在最顶上而是跟随滚动而消失或者出现 325 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 326 | if (scrollView == _tableView) { 327 | CGFloat sectionHeaderHeight = 36; 328 | 329 | if (scrollView.contentOffset.y <= sectionHeaderHeight && scrollView.contentOffset.y >= 0) { 330 | scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); 331 | } else if (scrollView.contentOffset.y >= sectionHeaderHeight) { 332 | scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); 333 | } 334 | } 335 | } 336 | #pragma 20.UIImage与字符串互转 337 | //图片转字符串 338 | -(NSString *)UIImageToBase64Str:(UIImage *) image 339 | { 340 | NSData *data = UIImageJPEGRepresentation(image, 1.0f); 341 | NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; 342 | return encodedImageStr; 343 | } 344 | 345 | //字符串转图片 346 | -(UIImage *)Base64StrToUIImage:(NSString *)_encodedImageStr 347 | { 348 | NSData *_decodedImageData = [[NSData alloc] initWithBase64Encoding:_encodedImageStr]; 349 | UIImage *_decodedImage = [UIImage imageWithData:_decodedImageData]; 350 | return _decodedImage; 351 | } 352 | #pragma 21.判断NSString中是否包含中文 353 | -(BOOL)isChinese:(NSString *)str{ 354 | NSString *match=@"(^[\u4e00-\u9fa5]+$)"; 355 | NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF matches %@", match]; 356 | return [predicate evaluateWithObject:str]; 357 | } 358 | #pragma 22.NSDate与NSString的相互转化 359 | -(NSString *)dateToString:(NSDate *)date { 360 | // 初始化时间格式控制器 361 | NSDateFormatter *matter = [[NSDateFormatter alloc] init]; 362 | // 设置设计格式 363 | [matter setDateFormat:@"yyyy-MM-dd hh:mm:ss zzz"]; 364 | // 进行转换 365 | NSString *dateStr = [matter stringFromDate:date]; 366 | return dateStr; 367 | } 368 | -(NSDate *)stringToDate:(NSString *)dateStr { 369 | 370 | // 初始化时间格式控制器 371 | NSDateFormatter *matter = [[NSDateFormatter alloc] init]; 372 | // 设置设计格式 373 | [matter setDateFormat:@"yyyy-MM-dd hh:mm:ss zzz"]; 374 | // 进行转换 375 | NSDate *date = [matter dateFromString:dateStr]; 376 | return date; 377 | } 378 | 379 | #pragma 23.控件的局部圆角 380 | 381 | CGRect rect = CGRectMake(0, 0, 100, 50); 382 | CGSize radio = CGSizeMake(5, 5);//圆角尺寸 383 | UIRectCorner corner = UIRectCornerTopLeft|UIRectCornerTopRight;//这只圆角位置 384 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corner cornerRadii:radio]; 385 | CAShapeLayer *masklayer = [[CAShapeLayer alloc]init];//创建shapelayer 386 | masklayer.frame = button.bounds; 387 | masklayer.path = path.CGPath;//设置路径 388 | button.layer.mask = masklayer; 389 | 390 | #pragma 24.navigationBar的透明问题 391 | //如果仅仅把navigationBar的alpha设为0的话,那就相当于把navigationBar给隐藏了,大家都知道,父视图的alpha设置为0的话,那么子视图全都会透明的。那么相应的navigationBar的标题和左右两个按钮都会消失。这样显然达不到我们要求的效果。 392 | (1)如果仅仅是想要navigationBar透明,按钮和标题都在可以使用以下方法: 393 | [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];//给navigationBar设置一个空的背景图片即可实现透明,而且标题按钮都在 394 | // 但是有细线,这就需要我们做进一步处理,把线去掉,如下方法即可: 395 | self.navigationController.navigationBar.shadowImage = [UIImage new]; 396 | //其实这个线也是image控制的。设为空即可 397 | (2)如果你想在透明的基础上实现根据下拉距离,由透明变得不透明的效果,那么上面那个就显得力不从心了,这就需要我们采用另外一种方法了 398 | 399 | //navigationBar是一个复合视图,它是有许多个控件组成的,那么我们就可以从他的内部入手 400 | [[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0;//这里可以根据scrollView的偏移量来设置alpha就实现了渐变透明的效果 401 | 402 | #pragma 25.全局设置navigationBar标题的样式和barItem的标题样式 403 | //UIColorWithHexRGB( )这个方法是自己定义的,这里只需要给个颜色就好了 404 | [[UINavigationBar appearance] setBarTintColor:UIColorWithHexRGB(0xfefefe)]; 405 | 406 | [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:UIColorWithHexRGB(0xfe6d27)}]; 407 | 408 | 409 | [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:10],NSForegroundColorAttributeName : UIColorWithHexRGB(0x666666)} forState:UIControlStateNormal]; 410 | 411 | 412 | [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize] 413 | 414 | #pragma 26.侧滑手势返回 415 | 416 | iOS的侧滑返回手势有着很好的操作体验,不支持侧滑返回的应用绝对不是好应用。但是在开发过程中在自定义了返回按钮,或者某些webView,tableView等页面,侧滑返回手势失效,这时候就需要我们来进行设置一下了,可以在基类里面协商如下代码: 417 | 418 | if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { 419 | //需要遵循一下手势的代理 self.navigationController.interactivePopGestureRecognizer.delegate = self; 420 | self.navigationController.interactivePopGestureRecognizer.enabled = YES; 421 | } 422 | 423 | 问题:当返回navigationController的最顶层的Controller的时候。再次侧滑,这个时候你在点击一个push页面的操作,你会发现卡那了,半天才会有反应。 424 | 这是由于,在最顶层Controller手势依然有效,但是滑动后,并找不到返回的页面。造成软件卡顿,假死所以就要在rootViewController中让此手势失效。把下面的设为NO 425 | 426 | self.navigationController.interactivePopGestureRecognizer.enabled = YES; 427 | 428 | 当然你也可以使用一个第三方库,写的相当棒。他对系统的侧滑返回手势进行拓展,不用从边缘滑动,只要右滑即可返回。最重要的是,他只需要加入项目中即可,不需要一行代码即可实现。附上github 网址 429 | https://github.com/forkingdog/FDFullscreenPopGesture 430 | 431 | #pragma 27.给webView添加头视图 432 | 433 | //webView是一个复合视图,里面包含有一个scrollView,scrollView里面是一个UIWebBrowserView(负责显示WebView的内容) 434 | 435 | UIView *webBrowserView = self.webView.scrollView.subviews[0];//拿到webView的webBrowserView 436 | self.backHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth*2/3.0)]; 437 | [_backHeadImageView sd_setImageWithURL:[NSURL URLWithString:self.imageUrl] placeholderImage:[UIImage imageNamed:@"placeholderImage"]]; 438 | [self.webView insertSubview:_backHeadImageView belowSubview:self.webView.scrollView]; 439 | //把backHeadImageView插入到webView的scrollView下面 440 | CGRect frame = self.webBrowserView.frame; 441 | frame.origin.y = CGRectGetMaxY(_backHeadImageView.frame); 442 | self.webBrowserView.frame = frame; 443 | //更改webBrowserView的frame向下移backHeadImageView的高度,使其可见 444 | 445 | #pragma 28.模态跳转的动画设置 model 446 | 447 | DetailViewController *detailVC = [[DetailViewController alloc]init]; 448 | //UIModalTransitionStyleFlipHorizontal 翻转 449 | //UIModalTransitionStyleCoverVertical 底部滑出 450 | //UIModalTransitionStyleCrossDissolve 渐显 451 | //UIModalTransitionStylePartialCurl 翻页 452 | detailVC.modalTransitionStyle = UIModalTransitionStylePartialCurl; 453 | [self presentViewController:detailVC animated:YES completion:nil]; 454 | 455 | #pragma 29.图片处理只拿到图片的一部分 456 | 457 | UIImage *image = [UIImage imageNamed:filename]; 458 | CGImageRef imageRef = image.CGImage; 459 | CGRect rect = CGRectMake(origin.x, origin.y ,size.width, size.height); 460 | //这里的宽高是相对于图片的真实大小 461 | //比如你的图片是400x400的那么(0,0,400,400)就是图片的全尺寸,想取哪一部分就设置相应坐标即可 462 | CGImageRef imageRefRect = CGImageCreateWithImageInRect(imageRef, rect); 463 | UIImage *imageRect = [[UIImage alloc] initWithCGImage:imageRefRect]; 464 | 465 | #pragma 30.给UIView设置图片 466 | UIImage *image = [UIImage imageNamed:@"playing"]; 467 | _layerView.layer.contents = (__bridge id)image.CGImage; 468 | _layerView.layer.contentsCenter = CGRectMake(0.25, 0.25, 0.5, 0.5); 469 | //同样可以设置显示的图片范围 470 | //不过此处略有不同,这里的四个值均为0-1之间;对应的依然是写x,y,widt,height 471 | 472 | #pragma 31.给TableView或者CollectionView的cell添加简单动画 473 | 只要在willDisplayCell方法中对将要显示的cell做动画即可: 474 | 475 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 476 | NSArray *array = tableView.indexPathsForVisibleRows; 477 | NSIndexPath *firstIndexPath = array[0]; 478 | 479 | 480 | //设置anchorPoint 481 | cell.layer.anchorPoint = CGPointMake(0, 0.5); 482 | //为了防止cell视图移动,重新把cell放回原来的位置 483 | cell.layer.position = CGPointMake(0, cell.layer.position.y); 484 | 485 | 486 | //设置cell 按照z轴旋转90度,注意是弧度 487 | if (firstIndexPath.row < indexPath.row) { 488 | cell.layer.transform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1.0); 489 | }else{ 490 | cell.layer.transform = CATransform3DMakeRotation(- M_PI_2, 0, 0, 1.0); 491 | } 492 | 493 | 494 | cell.alpha = 0.0; 495 | 496 | 497 | [UIView animateWithDuration:1 animations:^{ 498 | cell.layer.transform = CATransform3DIdentity; 499 | cell.alpha = 1.0; 500 | }]; 501 | } 502 | - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{ 503 | 504 | 505 | if (indexPath.row % 2 != 0) { 506 | cell.transform = CGAffineTransformTranslate(cell.transform, kScreenWidth/2, 0); 507 | }else{ 508 | cell.transform = CGAffineTransformTranslate(cell.transform, -kScreenWidth/2, 0); 509 | } 510 | cell.alpha = 0.0; 511 | [UIView animateWithDuration:0.7 animations:^{ 512 | cell.transform = CGAffineTransformIdentity; 513 | cell.alpha = 1.0; 514 | } completion:^(BOOL finished) { 515 | 516 | 517 | }]; 518 | } 519 | 520 | 521 | #pragma 32.两点之间的距离 522 | 523 | static __inline__ CGFloat CGPointDistanceBetweenTwoPoints(CGPoint point1, CGPoint point2) 524 | { 525 | CGFloat dx = point2.x - point1.x; CGFloat dy = point2.y - point1.y; return sqrt(dx*dx + dy*dy); 526 | } 527 | #pragma 32.线程中更新 UILabel的text 528 | //abel1 为UILabel,当在子线程中,需要进行text的更新的时候,可以使用这个方法来更新。 529 | // 其他的UIView 也都是一样的。 530 | [self.label1 performSelectorOnMainThread:@selector(setText:) withObject:textDisplay waitUntilDone:YES]; 531 | #pragma 33.获得当前硬盘空间 532 | NSFileManager *fm = [NSFileManager defaultManager]; 533 | NSDictionary *fattributes = [fm attributesOfFileSystemForPath:NSHomeDirectory() error:nil]; 534 | 535 | 536 | NSLog(@"容量%lldG",[[fattributes objectForKey:NSFileSystemSize] longLongValue]/1000000000); 537 | NSLog(@"可用%lldG",[[fattributes objectForKey:NSFileSystemFreeSize] longLongValue]/1000000000); 538 | #pragma 34.ActivityViewController 使用AirDrop分享 539 | 使用AirDrop 进行分享: 540 | NSArray *array = @[@"test1", @"test2"]; 541 | 542 | UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:array applicationActivities:nil]; 543 | 544 | [self presentViewController:activityVC animated:YES 545 | completion:^{ 546 | NSLog(@"Air"); 547 | }]; 548 | #pragma 35.保存全屏为image 549 | 550 | CGSize imageSize = [[UIScreen mainScreen] bounds].size; 551 | UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); 552 | CGContextRef context = UIGraphicsGetCurrentContext(); 553 | 554 | 555 | for (UIWindow * window in [[UIApplication sharedApplication] windows]) { 556 | if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { 557 | CGContextSaveGState(context); 558 | CGContextTranslateCTM(context, [window center].x, [window center].y); 559 | CGContextConcatCTM(context, [window transform]); 560 | CGContextTranslateCTM(context, -[window bounds].size.width*[[window layer] anchorPoint].x, -[window bounds].size.height*[[window layer] anchorPoint].y); 561 | [[window layer] renderInContext:context]; 562 | 563 | 564 | CGContextRestoreGState(context); 565 | } 566 | } 567 | 568 | 569 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 570 | 571 | #pragma 36.获取通讯录联系人的电话号码 572 | 573 | #import 574 | #import 575 | ABPeoplePickerNavigationControllerDelegate 576 | 577 | - (void)addAddress 578 | { 579 | RYLog(@"选择联系人"); 580 | ABPeoplePickerNavigationController * vc = [[ABPeoplePickerNavigationController alloc] init]; 581 | vc.peoplePickerDelegate = self; 582 | [self presentViewController:vc animated:YES completion:nil]; 583 | 584 | } 585 | 586 | #pragma mark -- ABPeoplePickerNavigationControllerDelegate 587 | - (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { 588 | 589 | ABMultiValueRef valuesRef = ABRecordCopyValue(person, kABPersonPhoneProperty); 590 | CFIndex index = ABMultiValueGetIndexForIdentifier(valuesRef,identifier); 591 | //电话号码 592 | CFStringRef telValue = ABMultiValueCopyValueAtIndex(valuesRef,index); 593 | 594 | [self dismissViewControllerAnimated:YES completion:^{ 595 | self.addressV.telnum.text = (__bridge NSString *)telValue; 596 | 597 | 598 | }]; 599 | } 600 | 601 | #pragma 37.用WebView加载页面,提前获取页面的高度 602 | 可以获得内容高度,但是网络不好时,不准确 603 | 1.webView.scrollView.contentSize.height; 604 | 605 | 获取的高度较为准确 606 | 2.[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] intValue] 607 | 608 | @end 609 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // 常用知识点汇总 4 | // 5 | // Created by 祥云创想 on 16/6/28. 6 | // Copyright © 2016年 Lee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // 常用知识点汇总 4 | // 5 | // Created by 祥云创想 on 16/6/28. 6 | // Copyright © 2016年 Lee. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /常用知识点汇总/常用知识点汇总/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 常用知识点汇总 4 | // 5 | // Created by 祥云创想 on 16/6/28. 6 | // Copyright © 2016年 Lee. 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 | --------------------------------------------------------------------------------