├── LICENSE ├── README.md ├── ViewAnimation ├── ViewAnimation.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── admin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── admin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── ViewAnimation │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── PrefixHeader.pch │ ├── VC │ ├── FrameVC.h │ └── FrameVC.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── WebView_cell ├── README.md ├── WebView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ ├── jikesoft.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── zhanglei.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── jikesoft.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── WebView.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── zhanglei.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── WebView.xcscheme │ │ └── xcschememanagement.plist ├── WebView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── TableViewCell.h │ ├── TableViewCell.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── WebViewTests │ ├── Info.plist │ └── WebViewTests.m └── WebviewMenu ├── README.md ├── WebviewMenu.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── admin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── admin.xcuserdatad │ └── xcschemes │ ├── WebviewMenu.xcscheme │ └── xcschememanagement.plist └── WebviewMenu ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CustomWebView.h ├── CustomWebView.m ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m /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 | ### 功能实例列举 2 | 3 | [WebView_cell](https://github.com/YiQieSuiYuan/Demo/tree/master/WebView_cell) iOS UITableViewCell嵌套UIWebView 4 | 5 | [WebviewMenu](https://github.com/YiQieSuiYuan/Demo/tree/master/WebviewMenu) iOS UIWebView自定义菜单栏 6 | 7 | [BrightnessVolumeView](https://github.com/YiQieSuiYuan/BrightnessVolumeView) iOS 音量和亮度控制 8 | 9 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 845648E51FBE7322007E196D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 845648E41FBE7322007E196D /* AppDelegate.m */; }; 11 | 845648E81FBE7322007E196D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 845648E71FBE7322007E196D /* ViewController.m */; }; 12 | 845648EB1FBE7322007E196D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 845648E91FBE7322007E196D /* Main.storyboard */; }; 13 | 845648ED1FBE7322007E196D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 845648EC1FBE7322007E196D /* Assets.xcassets */; }; 14 | 845648F01FBE7322007E196D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 845648EE1FBE7322007E196D /* LaunchScreen.storyboard */; }; 15 | 845648F31FBE7322007E196D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 845648F21FBE7322007E196D /* main.m */; }; 16 | 84AF60DC1FBE755A00CD0165 /* FrameVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AF60DB1FBE755A00CD0165 /* FrameVC.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 845648E01FBE7322007E196D /* ViewAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ViewAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 845648E31FBE7322007E196D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 22 | 845648E41FBE7322007E196D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 23 | 845648E61FBE7322007E196D /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 24 | 845648E71FBE7322007E196D /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 25 | 845648EA1FBE7322007E196D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | 845648EC1FBE7322007E196D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 845648EF1FBE7322007E196D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 845648F11FBE7322007E196D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 845648F21FBE7322007E196D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | 84AF60DA1FBE755A00CD0165 /* FrameVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameVC.h; sourceTree = ""; }; 31 | 84AF60DB1FBE755A00CD0165 /* FrameVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FrameVC.m; sourceTree = ""; }; 32 | 84AF60DD1FBE78FD00CD0165 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 845648DD1FBE7322007E196D /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 845648D71FBE7322007E196D = { 47 | isa = PBXGroup; 48 | children = ( 49 | 845648E21FBE7322007E196D /* ViewAnimation */, 50 | 845648E11FBE7322007E196D /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | 845648E11FBE7322007E196D /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 845648E01FBE7322007E196D /* ViewAnimation.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 845648E21FBE7322007E196D /* ViewAnimation */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 845648E31FBE7322007E196D /* AppDelegate.h */, 66 | 845648E41FBE7322007E196D /* AppDelegate.m */, 67 | 845648E61FBE7322007E196D /* ViewController.h */, 68 | 845648E71FBE7322007E196D /* ViewController.m */, 69 | 845648E91FBE7322007E196D /* Main.storyboard */, 70 | 84AF60DD1FBE78FD00CD0165 /* PrefixHeader.pch */, 71 | 84AF60D81FBE74FC00CD0165 /* VC */, 72 | 845648EC1FBE7322007E196D /* Assets.xcassets */, 73 | 845648EE1FBE7322007E196D /* LaunchScreen.storyboard */, 74 | 845648F11FBE7322007E196D /* Info.plist */, 75 | 845648F21FBE7322007E196D /* main.m */, 76 | ); 77 | path = ViewAnimation; 78 | sourceTree = ""; 79 | }; 80 | 84AF60D81FBE74FC00CD0165 /* VC */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 84AF60DA1FBE755A00CD0165 /* FrameVC.h */, 84 | 84AF60DB1FBE755A00CD0165 /* FrameVC.m */, 85 | ); 86 | path = VC; 87 | sourceTree = ""; 88 | }; 89 | /* End PBXGroup section */ 90 | 91 | /* Begin PBXNativeTarget section */ 92 | 845648DF1FBE7322007E196D /* ViewAnimation */ = { 93 | isa = PBXNativeTarget; 94 | buildConfigurationList = 845648F61FBE7322007E196D /* Build configuration list for PBXNativeTarget "ViewAnimation" */; 95 | buildPhases = ( 96 | 845648DC1FBE7322007E196D /* Sources */, 97 | 845648DD1FBE7322007E196D /* Frameworks */, 98 | 845648DE1FBE7322007E196D /* Resources */, 99 | ); 100 | buildRules = ( 101 | ); 102 | dependencies = ( 103 | ); 104 | name = ViewAnimation; 105 | productName = ViewAnimation; 106 | productReference = 845648E01FBE7322007E196D /* ViewAnimation.app */; 107 | productType = "com.apple.product-type.application"; 108 | }; 109 | /* End PBXNativeTarget section */ 110 | 111 | /* Begin PBXProject section */ 112 | 845648D81FBE7322007E196D /* Project object */ = { 113 | isa = PBXProject; 114 | attributes = { 115 | LastUpgradeCheck = 0910; 116 | ORGANIZATIONNAME = admin; 117 | TargetAttributes = { 118 | 845648DF1FBE7322007E196D = { 119 | CreatedOnToolsVersion = 9.1; 120 | ProvisioningStyle = Automatic; 121 | }; 122 | }; 123 | }; 124 | buildConfigurationList = 845648DB1FBE7322007E196D /* Build configuration list for PBXProject "ViewAnimation" */; 125 | compatibilityVersion = "Xcode 8.0"; 126 | developmentRegion = en; 127 | hasScannedForEncodings = 0; 128 | knownRegions = ( 129 | en, 130 | Base, 131 | ); 132 | mainGroup = 845648D71FBE7322007E196D; 133 | productRefGroup = 845648E11FBE7322007E196D /* Products */; 134 | projectDirPath = ""; 135 | projectRoot = ""; 136 | targets = ( 137 | 845648DF1FBE7322007E196D /* ViewAnimation */, 138 | ); 139 | }; 140 | /* End PBXProject section */ 141 | 142 | /* Begin PBXResourcesBuildPhase section */ 143 | 845648DE1FBE7322007E196D /* Resources */ = { 144 | isa = PBXResourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | 845648F01FBE7322007E196D /* LaunchScreen.storyboard in Resources */, 148 | 845648ED1FBE7322007E196D /* Assets.xcassets in Resources */, 149 | 845648EB1FBE7322007E196D /* Main.storyboard in Resources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXResourcesBuildPhase section */ 154 | 155 | /* Begin PBXSourcesBuildPhase section */ 156 | 845648DC1FBE7322007E196D /* Sources */ = { 157 | isa = PBXSourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 84AF60DC1FBE755A00CD0165 /* FrameVC.m in Sources */, 161 | 845648E81FBE7322007E196D /* ViewController.m in Sources */, 162 | 845648F31FBE7322007E196D /* main.m in Sources */, 163 | 845648E51FBE7322007E196D /* AppDelegate.m in Sources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXSourcesBuildPhase section */ 168 | 169 | /* Begin PBXVariantGroup section */ 170 | 845648E91FBE7322007E196D /* Main.storyboard */ = { 171 | isa = PBXVariantGroup; 172 | children = ( 173 | 845648EA1FBE7322007E196D /* Base */, 174 | ); 175 | name = Main.storyboard; 176 | sourceTree = ""; 177 | }; 178 | 845648EE1FBE7322007E196D /* LaunchScreen.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | 845648EF1FBE7322007E196D /* Base */, 182 | ); 183 | name = LaunchScreen.storyboard; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | 845648F41FBE7322007E196D /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 195 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 196 | CLANG_CXX_LIBRARY = "libc++"; 197 | CLANG_ENABLE_MODULES = YES; 198 | CLANG_ENABLE_OBJC_ARC = YES; 199 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_COMMA = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 204 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 205 | CLANG_WARN_EMPTY_BODY = YES; 206 | CLANG_WARN_ENUM_CONVERSION = YES; 207 | CLANG_WARN_INFINITE_RECURSION = YES; 208 | CLANG_WARN_INT_CONVERSION = YES; 209 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 210 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 212 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 213 | CLANG_WARN_STRICT_PROTOTYPES = YES; 214 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 215 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | CODE_SIGN_IDENTITY = "iPhone Developer"; 219 | COPY_PHASE_STRIP = NO; 220 | DEBUG_INFORMATION_FORMAT = dwarf; 221 | ENABLE_STRICT_OBJC_MSGSEND = YES; 222 | ENABLE_TESTABILITY = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu11; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_NO_COMMON_BLOCKS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 238 | MTL_ENABLE_DEBUG_INFO = YES; 239 | ONLY_ACTIVE_ARCH = YES; 240 | SDKROOT = iphoneos; 241 | }; 242 | name = Debug; 243 | }; 244 | 845648F51FBE7322007E196D /* Release */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_COMMA = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INFINITE_RECURSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 268 | CLANG_WARN_STRICT_PROTOTYPES = YES; 269 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 270 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | CODE_SIGN_IDENTITY = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 276 | ENABLE_NS_ASSERTIONS = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu11; 279 | GCC_NO_COMMON_BLOCKS = YES; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 287 | MTL_ENABLE_DEBUG_INFO = NO; 288 | SDKROOT = iphoneos; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Release; 292 | }; 293 | 845648F71FBE7322007E196D /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | CODE_SIGN_STYLE = Automatic; 298 | DEVELOPMENT_TEAM = L846R6TS7L; 299 | GCC_PREFIX_HEADER = ViewAnimation/PrefixHeader.pch; 300 | INFOPLIST_FILE = ViewAnimation/Info.plist; 301 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 302 | PRODUCT_BUNDLE_IDENTIFIER = com.feheadline.ViewAnimation; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | TARGETED_DEVICE_FAMILY = "1,2"; 305 | }; 306 | name = Debug; 307 | }; 308 | 845648F81FBE7322007E196D /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 312 | CODE_SIGN_STYLE = Automatic; 313 | DEVELOPMENT_TEAM = L846R6TS7L; 314 | GCC_PREFIX_HEADER = ViewAnimation/PrefixHeader.pch; 315 | INFOPLIST_FILE = ViewAnimation/Info.plist; 316 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 317 | PRODUCT_BUNDLE_IDENTIFIER = com.feheadline.ViewAnimation; 318 | PRODUCT_NAME = "$(TARGET_NAME)"; 319 | TARGETED_DEVICE_FAMILY = "1,2"; 320 | }; 321 | name = Release; 322 | }; 323 | /* End XCBuildConfiguration section */ 324 | 325 | /* Begin XCConfigurationList section */ 326 | 845648DB1FBE7322007E196D /* Build configuration list for PBXProject "ViewAnimation" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | 845648F41FBE7322007E196D /* Debug */, 330 | 845648F51FBE7322007E196D /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | 845648F61FBE7322007E196D /* Build configuration list for PBXNativeTarget "ViewAnimation" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | 845648F71FBE7322007E196D /* Debug */, 339 | 845648F81FBE7322007E196D /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | /* End XCConfigurationList section */ 345 | }; 346 | rootObject = 845648D81FBE7322007E196D /* Project object */; 347 | } 348 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-zlcode/ZlcodeTips/392971b84760b274f37c806e9133fd263fc8f0f3/ViewAnimation/ViewAnimation.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ViewAnimation.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. 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 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/Assets.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" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/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 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | // 屏幕的宽 13 | #define ScreenWidth [UIScreen mainScreen].bounds.size.width 14 | // 屏幕高 15 | #define ScreenHeight [UIScreen mainScreen].bounds.size.height 16 | //iPhoneX判断 17 | #define iPhoneX (ScreenWidth == 375.f && ScreenHeight == 812.f ? YES : NO) 18 | //状态栏的高度 19 | #define StatusBarHeight (iPhoneX ? 44.f : 20.f) 20 | //导航栏的高度 21 | #define NavigationBarHeight 44.f 22 | //信号栏加导航栏的高度 23 | #define StatusBarAndNavigationBarHeight (StatusBarHeight + NavigationBarHeight) 24 | //tabar高度 25 | #define TabbarHeight (iPhoneX ? (49.f+34.f) : 49.f) 26 | 27 | // 得到相对视图的坐标 28 | #define GET_LEFT(view) (view.frame.origin.x) 29 | #define GET_TOP(view) (view.frame.origin.y) 30 | #define GET_RIGHT(view) (view.frame.origin.x + view.frame.size.width) 31 | #define GET_BOTTOM(view) (view.frame.origin.y + view.frame.size.height) 32 | #define GET_WIDTH(view) (view.frame.size.width) 33 | #define GET_HEIGHT(view) (view.frame.size.height) 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/VC/FrameVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // FrameVC.h 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FrameVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/VC/FrameVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // FrameVC.m 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #import "FrameVC.h" 10 | 11 | @interface FrameVC () 12 | @property (nonatomic,strong) UIView *bigView; 13 | @property (nonatomic,strong) UIView *smallView; 14 | @property (nonatomic,strong) UIButton *startButton; 15 | @end 16 | 17 | @implementation FrameVC 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | [self initView]; 23 | } 24 | 25 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 26 | [self changeFrame]; 27 | } 28 | 29 | - (void)initView{ 30 | 31 | self.bigView = [UIView new]; 32 | self.bigView.backgroundColor = [UIColor redColor]; 33 | [self.view addSubview:self.bigView]; 34 | 35 | self.smallView = [UIView new]; 36 | self.smallView.backgroundColor = [UIColor blueColor]; 37 | [self.view addSubview:self.smallView]; 38 | 39 | self.startButton = [UIButton buttonWithType:UIButtonTypeSystem]; 40 | [self.startButton setTitle:@"开始动画" forState:UIControlStateNormal]; 41 | [self.startButton addTarget:self action:@selector(startButtonClick:) forControlEvents:UIControlEventTouchUpInside]; 42 | [self.view addSubview:self.startButton]; 43 | 44 | CGFloat edge = 50; 45 | self.bigView.frame = CGRectMake(edge, StatusBarAndNavigationBarHeight+edge, ScreenWidth-edge*2, (ScreenWidth-edge*2)/2); 46 | 47 | self.smallView.frame = CGRectMake(edge, GET_BOTTOM(self.bigView)+edge, GET_WIDTH(self.bigView)*0.5, GET_HEIGHT(self.bigView)*0.5); 48 | 49 | self.startButton.frame = CGRectMake(0, ScreenHeight-50, ScreenWidth, 50); 50 | } 51 | 52 | - (void)startButtonClick:(UIButton *)sender{ 53 | [self changeFrame]; 54 | } 55 | 56 | - (void)changeFrame { 57 | [UIView beginAnimations:@"FrameAni" context:nil]; 58 | [UIView setAnimationDuration:1.0]; 59 | [UIView setAnimationDelegate:self]; 60 | [UIView setAnimationWillStartSelector:@selector(animationStart:)]; 61 | [UIView setAnimationDidStopSelector:@selector(animationStop:)]; 62 | [UIView setAnimationRepeatCount:1]; 63 | [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 64 | self.smallView.frame = self.bigView.frame; 65 | [UIView commitAnimations]; 66 | } 67 | 68 | #pragma mark - anmaiton delegate 69 | - (void)animationWillStart:(NSString *)animationID context:(void *)context{ 70 | NSLog(@"%@ xxx",animationID); 71 | } 72 | 73 | - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{ 74 | NSLog(@"%@ yyy",animationID); 75 | } 76 | 77 | #pragma SEL 78 | - (void)animationStart:(NSString *)animationID { 79 | NSLog(@"%@ start",animationID); 80 | } 81 | 82 | - (void)animationStop:(NSString *)animationID { 83 | NSLog(@"%@ stop",animationID); 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 13 | @property (nonatomic,strong) NSArray *titleArray; 14 | @property (nonatomic,strong) NSArray *classArray; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.title = @"UIView Animation"; 23 | 24 | [self initData]; 25 | } 26 | 27 | - (void)initData{ 28 | self.titleArray = @[@"frame 动画"]; 29 | self.classArray = @[@"FrameVC"]; 30 | } 31 | 32 | #pragma mark - table delegate 33 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 34 | return self.titleArray.count; 35 | } 36 | 37 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 38 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 39 | if (!cell) { 40 | [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"]; 41 | cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 42 | } 43 | 44 | cell.textLabel.text = self.titleArray[indexPath.row]; 45 | 46 | return cell; 47 | } 48 | 49 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 50 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 51 | 52 | UIViewController *vc = [NSClassFromString(self.classArray[indexPath.row]) new]; 53 | vc.view.backgroundColor = [UIColor whiteColor]; 54 | vc.title = self.titleArray[indexPath.row]; 55 | [self.navigationController pushViewController:vc animated:YES]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /ViewAnimation/ViewAnimation/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ViewAnimation 4 | // 5 | // Created by admin on 2017/11/17. 6 | // Copyright © 2017年 admin. 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 | -------------------------------------------------------------------------------- /WebView_cell/README.md: -------------------------------------------------------------------------------- 1 | # Demo 2 | 3 | ### 功能实例列举 4 | WebView_cell iOS UITableViewCell嵌套UIWebView 5 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 480D6E501CCF3A70004DD4FB /* TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 480D6E4E1CCF3A70004DD4FB /* TableViewCell.m */; }; 11 | C62C07EA1CCF2C10008F73C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C62C07E91CCF2C10008F73C7 /* main.m */; }; 12 | C62C07ED1CCF2C10008F73C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C62C07EC1CCF2C10008F73C7 /* AppDelegate.m */; }; 13 | C62C07F01CCF2C10008F73C7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C62C07EF1CCF2C10008F73C7 /* ViewController.m */; }; 14 | C62C07F31CCF2C10008F73C7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C62C07F11CCF2C10008F73C7 /* Main.storyboard */; }; 15 | C62C07F51CCF2C10008F73C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C62C07F41CCF2C10008F73C7 /* Images.xcassets */; }; 16 | C62C07F81CCF2C10008F73C7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C62C07F61CCF2C10008F73C7 /* LaunchScreen.xib */; }; 17 | C62C08041CCF2C10008F73C7 /* WebViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C62C08031CCF2C10008F73C7 /* WebViewTests.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | C62C07FE1CCF2C10008F73C7 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = C62C07DC1CCF2C10008F73C7 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = C62C07E31CCF2C10008F73C7; 26 | remoteInfo = WebView; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 480D6E4D1CCF3A70004DD4FB /* TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewCell.h; sourceTree = ""; }; 32 | 480D6E4E1CCF3A70004DD4FB /* TableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewCell.m; sourceTree = ""; }; 33 | C62C07E41CCF2C10008F73C7 /* WebView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | C62C07E81CCF2C10008F73C7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | C62C07E91CCF2C10008F73C7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | C62C07EB1CCF2C10008F73C7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | C62C07EC1CCF2C10008F73C7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | C62C07EE1CCF2C10008F73C7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | C62C07EF1CCF2C10008F73C7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | C62C07F21CCF2C10008F73C7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | C62C07F41CCF2C10008F73C7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | C62C07F71CCF2C10008F73C7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | C62C07FD1CCF2C10008F73C7 /* WebViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | C62C08021CCF2C10008F73C7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | C62C08031CCF2C10008F73C7 /* WebViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WebViewTests.m; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | C62C07E11CCF2C10008F73C7 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | C62C07FA1CCF2C10008F73C7 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | C62C07DB1CCF2C10008F73C7 = { 67 | isa = PBXGroup; 68 | children = ( 69 | C62C07E61CCF2C10008F73C7 /* WebView */, 70 | C62C08001CCF2C10008F73C7 /* WebViewTests */, 71 | C62C07E51CCF2C10008F73C7 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | C62C07E51CCF2C10008F73C7 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | C62C07E41CCF2C10008F73C7 /* WebView.app */, 79 | C62C07FD1CCF2C10008F73C7 /* WebViewTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | C62C07E61CCF2C10008F73C7 /* WebView */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | C62C07EB1CCF2C10008F73C7 /* AppDelegate.h */, 88 | C62C07EC1CCF2C10008F73C7 /* AppDelegate.m */, 89 | C62C07EE1CCF2C10008F73C7 /* ViewController.h */, 90 | C62C07EF1CCF2C10008F73C7 /* ViewController.m */, 91 | C62C07F11CCF2C10008F73C7 /* Main.storyboard */, 92 | 480D6E4D1CCF3A70004DD4FB /* TableViewCell.h */, 93 | 480D6E4E1CCF3A70004DD4FB /* TableViewCell.m */, 94 | C62C07F41CCF2C10008F73C7 /* Images.xcassets */, 95 | C62C07F61CCF2C10008F73C7 /* LaunchScreen.xib */, 96 | C62C07E71CCF2C10008F73C7 /* Supporting Files */, 97 | ); 98 | path = WebView; 99 | sourceTree = ""; 100 | }; 101 | C62C07E71CCF2C10008F73C7 /* Supporting Files */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | C62C07E81CCF2C10008F73C7 /* Info.plist */, 105 | C62C07E91CCF2C10008F73C7 /* main.m */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | C62C08001CCF2C10008F73C7 /* WebViewTests */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | C62C08031CCF2C10008F73C7 /* WebViewTests.m */, 114 | C62C08011CCF2C10008F73C7 /* Supporting Files */, 115 | ); 116 | path = WebViewTests; 117 | sourceTree = ""; 118 | }; 119 | C62C08011CCF2C10008F73C7 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | C62C08021CCF2C10008F73C7 /* Info.plist */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | C62C07E31CCF2C10008F73C7 /* WebView */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = C62C08071CCF2C10008F73C7 /* Build configuration list for PBXNativeTarget "WebView" */; 133 | buildPhases = ( 134 | C62C07E01CCF2C10008F73C7 /* Sources */, 135 | C62C07E11CCF2C10008F73C7 /* Frameworks */, 136 | C62C07E21CCF2C10008F73C7 /* Resources */, 137 | ); 138 | buildRules = ( 139 | ); 140 | dependencies = ( 141 | ); 142 | name = WebView; 143 | productName = WebView; 144 | productReference = C62C07E41CCF2C10008F73C7 /* WebView.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | C62C07FC1CCF2C10008F73C7 /* WebViewTests */ = { 148 | isa = PBXNativeTarget; 149 | buildConfigurationList = C62C080A1CCF2C10008F73C7 /* Build configuration list for PBXNativeTarget "WebViewTests" */; 150 | buildPhases = ( 151 | C62C07F91CCF2C10008F73C7 /* Sources */, 152 | C62C07FA1CCF2C10008F73C7 /* Frameworks */, 153 | C62C07FB1CCF2C10008F73C7 /* Resources */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | C62C07FF1CCF2C10008F73C7 /* PBXTargetDependency */, 159 | ); 160 | name = WebViewTests; 161 | productName = WebViewTests; 162 | productReference = C62C07FD1CCF2C10008F73C7 /* WebViewTests.xctest */; 163 | productType = "com.apple.product-type.bundle.unit-test"; 164 | }; 165 | /* End PBXNativeTarget section */ 166 | 167 | /* Begin PBXProject section */ 168 | C62C07DC1CCF2C10008F73C7 /* Project object */ = { 169 | isa = PBXProject; 170 | attributes = { 171 | LastUpgradeCheck = 0640; 172 | ORGANIZATIONNAME = JKLazyCat; 173 | TargetAttributes = { 174 | C62C07E31CCF2C10008F73C7 = { 175 | CreatedOnToolsVersion = 6.4; 176 | }; 177 | C62C07FC1CCF2C10008F73C7 = { 178 | CreatedOnToolsVersion = 6.4; 179 | TestTargetID = C62C07E31CCF2C10008F73C7; 180 | }; 181 | }; 182 | }; 183 | buildConfigurationList = C62C07DF1CCF2C10008F73C7 /* Build configuration list for PBXProject "WebView" */; 184 | compatibilityVersion = "Xcode 3.2"; 185 | developmentRegion = English; 186 | hasScannedForEncodings = 0; 187 | knownRegions = ( 188 | en, 189 | Base, 190 | ); 191 | mainGroup = C62C07DB1CCF2C10008F73C7; 192 | productRefGroup = C62C07E51CCF2C10008F73C7 /* Products */; 193 | projectDirPath = ""; 194 | projectRoot = ""; 195 | targets = ( 196 | C62C07E31CCF2C10008F73C7 /* WebView */, 197 | C62C07FC1CCF2C10008F73C7 /* WebViewTests */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | C62C07E21CCF2C10008F73C7 /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | C62C07F31CCF2C10008F73C7 /* Main.storyboard in Resources */, 208 | C62C07F81CCF2C10008F73C7 /* LaunchScreen.xib in Resources */, 209 | C62C07F51CCF2C10008F73C7 /* Images.xcassets in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | C62C07FB1CCF2C10008F73C7 /* Resources */ = { 214 | isa = PBXResourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | C62C07E01CCF2C10008F73C7 /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | C62C07F01CCF2C10008F73C7 /* ViewController.m in Sources */, 228 | 480D6E501CCF3A70004DD4FB /* TableViewCell.m in Sources */, 229 | C62C07ED1CCF2C10008F73C7 /* AppDelegate.m in Sources */, 230 | C62C07EA1CCF2C10008F73C7 /* main.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | C62C07F91CCF2C10008F73C7 /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | C62C08041CCF2C10008F73C7 /* WebViewTests.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXTargetDependency section */ 245 | C62C07FF1CCF2C10008F73C7 /* PBXTargetDependency */ = { 246 | isa = PBXTargetDependency; 247 | target = C62C07E31CCF2C10008F73C7 /* WebView */; 248 | targetProxy = C62C07FE1CCF2C10008F73C7 /* PBXContainerItemProxy */; 249 | }; 250 | /* End PBXTargetDependency section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | C62C07F11CCF2C10008F73C7 /* Main.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | C62C07F21CCF2C10008F73C7 /* Base */, 257 | ); 258 | name = Main.storyboard; 259 | sourceTree = ""; 260 | }; 261 | C62C07F61CCF2C10008F73C7 /* LaunchScreen.xib */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | C62C07F71CCF2C10008F73C7 /* Base */, 265 | ); 266 | name = LaunchScreen.xib; 267 | sourceTree = ""; 268 | }; 269 | /* End PBXVariantGroup section */ 270 | 271 | /* Begin XCBuildConfiguration section */ 272 | C62C08051CCF2C10008F73C7 /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ALWAYS_SEARCH_USER_PATHS = NO; 276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 277 | CLANG_CXX_LIBRARY = "libc++"; 278 | CLANG_ENABLE_MODULES = YES; 279 | CLANG_ENABLE_OBJC_ARC = YES; 280 | CLANG_WARN_BOOL_CONVERSION = YES; 281 | CLANG_WARN_CONSTANT_CONVERSION = YES; 282 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 290 | COPY_PHASE_STRIP = NO; 291 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 292 | ENABLE_STRICT_OBJC_MSGSEND = YES; 293 | GCC_C_LANGUAGE_STANDARD = gnu99; 294 | GCC_DYNAMIC_NO_PIC = NO; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PREPROCESSOR_DEFINITIONS = ( 298 | "DEBUG=1", 299 | "$(inherited)", 300 | ); 301 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 302 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 303 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 304 | GCC_WARN_UNDECLARED_SELECTOR = YES; 305 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 306 | GCC_WARN_UNUSED_FUNCTION = YES; 307 | GCC_WARN_UNUSED_VARIABLE = YES; 308 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 309 | MTL_ENABLE_DEBUG_INFO = YES; 310 | ONLY_ACTIVE_ARCH = YES; 311 | SDKROOT = iphoneos; 312 | }; 313 | name = Debug; 314 | }; 315 | C62C08061CCF2C10008F73C7 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 320 | CLANG_CXX_LIBRARY = "libc++"; 321 | CLANG_ENABLE_MODULES = YES; 322 | CLANG_ENABLE_OBJC_ARC = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 335 | ENABLE_NS_ASSERTIONS = NO; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_NO_COMMON_BLOCKS = YES; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 346 | MTL_ENABLE_DEBUG_INFO = NO; 347 | SDKROOT = iphoneos; 348 | VALIDATE_PRODUCT = YES; 349 | }; 350 | name = Release; 351 | }; 352 | C62C08081CCF2C10008F73C7 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 356 | INFOPLIST_FILE = WebView/Info.plist; 357 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 358 | PRODUCT_NAME = "$(TARGET_NAME)"; 359 | }; 360 | name = Debug; 361 | }; 362 | C62C08091CCF2C10008F73C7 /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | INFOPLIST_FILE = WebView/Info.plist; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | }; 370 | name = Release; 371 | }; 372 | C62C080B1CCF2C10008F73C7 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | BUNDLE_LOADER = "$(TEST_HOST)"; 376 | FRAMEWORK_SEARCH_PATHS = ( 377 | "$(SDKROOT)/Developer/Library/Frameworks", 378 | "$(inherited)", 379 | ); 380 | GCC_PREPROCESSOR_DEFINITIONS = ( 381 | "DEBUG=1", 382 | "$(inherited)", 383 | ); 384 | INFOPLIST_FILE = WebViewTests/Info.plist; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/WebView.app/WebView"; 388 | }; 389 | name = Debug; 390 | }; 391 | C62C080C1CCF2C10008F73C7 /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | BUNDLE_LOADER = "$(TEST_HOST)"; 395 | FRAMEWORK_SEARCH_PATHS = ( 396 | "$(SDKROOT)/Developer/Library/Frameworks", 397 | "$(inherited)", 398 | ); 399 | INFOPLIST_FILE = WebViewTests/Info.plist; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 401 | PRODUCT_NAME = "$(TARGET_NAME)"; 402 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/WebView.app/WebView"; 403 | }; 404 | name = Release; 405 | }; 406 | /* End XCBuildConfiguration section */ 407 | 408 | /* Begin XCConfigurationList section */ 409 | C62C07DF1CCF2C10008F73C7 /* Build configuration list for PBXProject "WebView" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C62C08051CCF2C10008F73C7 /* Debug */, 413 | C62C08061CCF2C10008F73C7 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | C62C08071CCF2C10008F73C7 /* Build configuration list for PBXNativeTarget "WebView" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | C62C08081CCF2C10008F73C7 /* Debug */, 422 | C62C08091CCF2C10008F73C7 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | C62C080A1CCF2C10008F73C7 /* Build configuration list for PBXNativeTarget "WebViewTests" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | C62C080B1CCF2C10008F73C7 /* Debug */, 431 | C62C080C1CCF2C10008F73C7 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | /* End XCConfigurationList section */ 437 | }; 438 | rootObject = C62C07DC1CCF2C10008F73C7 /* Project object */; 439 | } 440 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/project.xcworkspace/xcuserdata/jikesoft.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-zlcode/ZlcodeTips/392971b84760b274f37c806e9133fd263fc8f0f3/WebView_cell/WebView.xcodeproj/project.xcworkspace/xcuserdata/jikesoft.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/project.xcworkspace/xcuserdata/zhanglei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-zlcode/ZlcodeTips/392971b84760b274f37c806e9133fd263fc8f0f3/WebView_cell/WebView.xcodeproj/project.xcworkspace/xcuserdata/zhanglei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/jikesoft.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/jikesoft.xcuserdatad/xcschemes/WebView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/jikesoft.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WebView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C62C07E31CCF2C10008F73C7 16 | 17 | primary 18 | 19 | 20 | C62C07FC1CCF2C10008F73C7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/zhanglei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/zhanglei.xcuserdatad/xcschemes/WebView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /WebView_cell/WebView.xcodeproj/xcuserdata/zhanglei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WebView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C62C07E31CCF2C10008F73C7 16 | 17 | primary 18 | 19 | 20 | C62C07FC1CCF2C10008F73C7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /WebView_cell/WebView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // WebView 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /WebView_cell/WebView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // WebView 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. 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 | -------------------------------------------------------------------------------- /WebView_cell/WebView/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /WebView_cell/WebView/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 | -------------------------------------------------------------------------------- /WebView_cell/WebView/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /WebView_cell/WebView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | info.diantong.com.$(PRODUCT_NAME:rfc1034identifier) 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 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /WebView_cell/WebView/TableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.h 3 | // WebView 4 | // 5 | // Created by zhanglei on 16/4/26. 6 | // Copyright © 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableViewCell : UITableViewCell 12 | 13 | @property (nonatomic,strong) NSString *contentStr; 14 | @property (nonatomic,assign) CGFloat height; 15 | @property (strong, nonatomic) UIWebView *webView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WebView_cell/WebView/TableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.m 3 | // WebView 4 | // 5 | // Created by zhanglei on 16/4/26. 6 | // Copyright © 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import "TableViewCell.h" 10 | 11 | @implementation TableViewCell 12 | 13 | -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) 17 | { 18 | self.selectionStyle = UITableViewCellSelectionStyleNone; 19 | 20 | NSLog(@"%@",NSStringFromCGRect(self.contentView.bounds)); 21 | 22 | // 高度必须提前赋一个值 >0 23 | self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 1)]; 24 | self.webView.backgroundColor = [UIColor clearColor]; 25 | self.webView.opaque = NO; 26 | self.webView.userInteractionEnabled = NO; 27 | self.webView.scrollView.bounces = NO; 28 | self.webView.delegate = self; 29 | self.webView.paginationBreakingMode = UIWebPaginationBreakingModePage; 30 | self.webView.scalesPageToFit = YES; 31 | [self.contentView addSubview:self.webView]; 32 | } 33 | return self; 34 | } 35 | 36 | // contentStr 用于更新值 37 | -(void)setContentStr:(NSString *)contentStr 38 | { 39 | _contentStr = contentStr; 40 | 41 | [self.webView loadHTMLString:contentStr baseURL:[NSURL URLWithString:@"http://www.baidu.com"]]; 42 | } 43 | 44 | #pragma mark - UIWebViewDelegate 45 | - (void)webViewDidFinishLoad:(UIWebView *)webView 46 | { 47 | // 如果要获取web高度必须在网页加载完成之后获取 48 | 49 | // 方法一 50 | CGSize fittingSize = [self.webView sizeThatFits:CGSizeZero]; 51 | 52 | // 方法二 53 | // CGSize fittingSize = webView.scrollView.contentSize; 54 | NSLog(@"webView:%@",NSStringFromCGSize(fittingSize)); 55 | self.height = fittingSize.height; 56 | 57 | self.webView.frame = CGRectMake(0, 0, fittingSize.width, fittingSize.height); 58 | 59 | // 用通知发送加载完成后的高度 60 | [[NSNotificationCenter defaultCenter] postNotificationName:@"WEBVIEW_HEIGHT" object:self userInfo:nil]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /WebView_cell/WebView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // WebView 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /WebView_cell/WebView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // WebView 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TableViewCell.h" 11 | 12 | @interface ViewController () 13 | 14 | @property(nonatomic,strong)UITableView *tableView; 15 | @property(nonatomic,strong)NSMutableDictionary *heightDic; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | 25 | self.heightDic = [[NSMutableDictionary alloc] init]; 26 | 27 | // 注册加载完成高度的通知 28 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noti:) name:@"WEBVIEW_HEIGHT" object:nil]; 29 | 30 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:UITableViewStyleGrouped]; 31 | _tableView.delegate = self; 32 | _tableView.dataSource = self; 33 | [self.tableView registerClass:[TableViewCell class] forCellReuseIdentifier:@"cell"]; 34 | [self.view addSubview:_tableView]; 35 | } 36 | 37 | #pragma mark - table delegate 38 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 39 | { 40 | return 3; 41 | } 42 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 43 | { 44 | TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 45 | cell.tag = indexPath.row; 46 | 47 | NSString *str = @"

"; 48 | 49 | // 赋值 把需要的html放里面就好了,不需要其他操作 50 | cell.contentStr = str; 51 | 52 | return cell; 53 | } 54 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 55 | { 56 | return CGFLOAT_MIN; 57 | } 58 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 59 | { 60 | return CGFLOAT_MIN; 61 | } 62 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 63 | { 64 | return [[self.heightDic objectForKey:[NSString stringWithFormat:@"%ld",indexPath.row]] floatValue];; 65 | } 66 | 67 | #pragma mark - 通知 68 | - (void)noti:(NSNotification *)sender 69 | { 70 | TableViewCell *cell = [sender object]; 71 | NSLog(@"%@",@(cell.tag)); 72 | 73 | if (![self.heightDic objectForKey:[NSString stringWithFormat:@"%ld",cell.tag]]||[[self.heightDic objectForKey:[NSString stringWithFormat:@"%ld",cell.tag]] floatValue] != cell.height) 74 | { 75 | [self.heightDic setObject:[NSNumber numberWithFloat:cell.height] forKey:[NSString stringWithFormat:@"%ld",cell.tag]]; 76 | [self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:cell.tag inSection:0]] withRowAnimation:UITableViewRowAnimationNone]; 77 | } 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /WebView_cell/WebView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WebView 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. 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 | -------------------------------------------------------------------------------- /WebView_cell/WebViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | info.diantong.com.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /WebView_cell/WebViewTests/WebViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewTests.m 3 | // WebViewTests 4 | // 5 | // Created by 张雷 on 16/4/26. 6 | // Copyright (c) 2016年 zlcode.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WebViewTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation WebViewTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WebviewMenu/README.md: -------------------------------------------------------------------------------- 1 | ### 主要代码 2 | 3 | CustomWebView.h 4 | 5 | ``` 6 | @interface CustomWebView : UIWebView 7 | 8 | 9 | @end 10 | 11 | ``` 12 | 13 | CustomWebView.m 14 | 15 | ``` 16 | #import "CustomWebView.h" 17 | 18 | @implementation CustomWebView 19 | 20 | -(id)initWithFrame:(CGRect)frame 21 | { 22 | self = [super initWithFrame:frame]; 23 | if (self) 24 | { 25 | // 全代码时入口 26 | [self addMenu]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | -(void)awakeFromNib 33 | { 34 | [super awakeFromNib]; 35 | 36 | // xib时入口 37 | [self addMenu]; 38 | } 39 | 40 | - (void)addMenu 41 | { 42 | UIMenuController *menuController = [UIMenuController sharedMenuController]; 43 | 44 | UIMenuItem *menuItemCopy = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(copyT:)]; 45 | 46 | UIMenuItem *menuItemNote = [[UIMenuItem alloc] initWithTitle:@"笔记" action:@selector(noteT:)]; 47 | 48 | UIMenuItem *menuItemSearch = [[UIMenuItem alloc] initWithTitle:@"搜索" action:@selector(searchT:)]; 49 | 50 | UIMenuItem *menuItemShare = [[UIMenuItem alloc] initWithTitle:@"分享" action:@selector(shareT:)]; 51 | 52 | NSArray *mArray = [NSArray arrayWithObjects:menuItemCopy,menuItemNote,menuItemSearch,menuItemShare,nil]; 53 | [menuController setMenuItems:mArray]; 54 | } 55 | 56 | -(BOOL)canPerformAction:(SEL)action withSender:(id)sender 57 | { 58 | if(action == @selector(copyT:) || action == @selector(noteT:) || action == @selector(searchT:) || action == @selector(shareT:)) 59 | { 60 | return YES; 61 | } 62 | 63 | return NO; 64 | } 65 | 66 | -(void)copyT:(id)sender 67 | { 68 | NSLog(@"复制"); 69 | } 70 | 71 | -(void)noteT:(id)sender 72 | { 73 | NSLog(@"笔记"); 74 | } 75 | 76 | -(void)searchT:(id)sender 77 | { 78 | NSLog(@"搜索"); 79 | } 80 | 81 | -(void)shareT:(id)sender 82 | { 83 | NSLog(@"分享"); 84 | } 85 | 86 | @end 87 | ``` 88 | 89 | ### 代码示例 90 | 91 | ``` 92 | CustomWebView *webview = [CustomWebView new]; 93 | webview.frame = self.view.bounds; 94 | [self.view addSubview:webview]; 95 | NSURL *url = [NSURL URLWithString:@"http://www.feheadline.com/webapp/detail.html?id=3374280"]; 96 | NSURLRequest *req = [[NSURLRequest alloc] initWithURL:url]; 97 | [webview loadRequest:req]; 98 | 99 | ``` 100 | 101 | 刚开始在CustomWebView.m的initWithFrame方法中,但是长按后菜单栏一直没有出来,后来发现,如果是通过xib添加此控件的话,通过断点跟踪就可发现,它是不会执行initWithFrame方法的,所以那段代码应该写在-(void)awakeFromNib方法中,如果是通过代码添加的,就应该写在initWithFrame方法中,否则不执行添加菜单的操作。 102 | 103 | -(BOOL)canPerformAction:(SEL)action withSender:(id)sender这个方法可以筛选出需要的菜单项,而自定义的WebView中已经重写了这个方法,所以在webview中弹出的菜单是需要的菜单项,在其他控件中例如TextField控件,弹出的依旧会是系统默认的菜单项,只是出于程序可读性,可维护性考虑,最好在自定义的控件中修改菜单性,单独封装起来。 104 | 105 | ### 图片示例: 106 | 107 | ![uiwebview-menu-1](http://blog.zlcode.com/wp-content/uploads/2016/09/uiwebview-menu-1.png) 108 | 109 | [完整代码下载](https://github.com/YiQieSuiYuan/Demo/tree/master/WebviewMenu) 110 | 111 | ### 参考 112 | [http://jingyan.baidu.com/article/ac6a9a5e7d3e282b653eac1b.html](http://jingyan.baidu.com/article/ac6a9a5e7d3e282b653eac1b.html) 113 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 84A69BD31D8E6635003B5F8F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A69BD21D8E6635003B5F8F /* main.m */; }; 11 | 84A69BD61D8E6635003B5F8F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A69BD51D8E6635003B5F8F /* AppDelegate.m */; }; 12 | 84A69BD91D8E6635003B5F8F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A69BD81D8E6635003B5F8F /* ViewController.m */; }; 13 | 84A69BDC1D8E6635003B5F8F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84A69BDA1D8E6635003B5F8F /* Main.storyboard */; }; 14 | 84A69BDE1D8E6635003B5F8F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84A69BDD1D8E6635003B5F8F /* Assets.xcassets */; }; 15 | 84A69BE11D8E6635003B5F8F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84A69BDF1D8E6635003B5F8F /* LaunchScreen.storyboard */; }; 16 | 84A69BEA1D8E6650003B5F8F /* CustomWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84A69BE91D8E6650003B5F8F /* CustomWebView.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 84A69BCE1D8E6635003B5F8F /* WebviewMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebviewMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 84A69BD21D8E6635003B5F8F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | 84A69BD41D8E6635003B5F8F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | 84A69BD51D8E6635003B5F8F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | 84A69BD71D8E6635003B5F8F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | 84A69BD81D8E6635003B5F8F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | 84A69BDB1D8E6635003B5F8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 84A69BDD1D8E6635003B5F8F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 84A69BE01D8E6635003B5F8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 84A69BE21D8E6635003B5F8F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 84A69BE81D8E6650003B5F8F /* CustomWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomWebView.h; sourceTree = ""; }; 31 | 84A69BE91D8E6650003B5F8F /* CustomWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomWebView.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 84A69BCB1D8E6635003B5F8F /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 84A69BC51D8E6635003B5F8F = { 46 | isa = PBXGroup; 47 | children = ( 48 | 84A69BD01D8E6635003B5F8F /* WebviewMenu */, 49 | 84A69BCF1D8E6635003B5F8F /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | 84A69BCF1D8E6635003B5F8F /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 84A69BCE1D8E6635003B5F8F /* WebviewMenu.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | 84A69BD01D8E6635003B5F8F /* WebviewMenu */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 84A69BE81D8E6650003B5F8F /* CustomWebView.h */, 65 | 84A69BE91D8E6650003B5F8F /* CustomWebView.m */, 66 | 84A69BD41D8E6635003B5F8F /* AppDelegate.h */, 67 | 84A69BD51D8E6635003B5F8F /* AppDelegate.m */, 68 | 84A69BD71D8E6635003B5F8F /* ViewController.h */, 69 | 84A69BD81D8E6635003B5F8F /* ViewController.m */, 70 | 84A69BDA1D8E6635003B5F8F /* Main.storyboard */, 71 | 84A69BDD1D8E6635003B5F8F /* Assets.xcassets */, 72 | 84A69BDF1D8E6635003B5F8F /* LaunchScreen.storyboard */, 73 | 84A69BE21D8E6635003B5F8F /* Info.plist */, 74 | 84A69BD11D8E6635003B5F8F /* Supporting Files */, 75 | ); 76 | path = WebviewMenu; 77 | sourceTree = ""; 78 | }; 79 | 84A69BD11D8E6635003B5F8F /* Supporting Files */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 84A69BD21D8E6635003B5F8F /* main.m */, 83 | ); 84 | name = "Supporting Files"; 85 | sourceTree = ""; 86 | }; 87 | /* End PBXGroup section */ 88 | 89 | /* Begin PBXNativeTarget section */ 90 | 84A69BCD1D8E6635003B5F8F /* WebviewMenu */ = { 91 | isa = PBXNativeTarget; 92 | buildConfigurationList = 84A69BE51D8E6635003B5F8F /* Build configuration list for PBXNativeTarget "WebviewMenu" */; 93 | buildPhases = ( 94 | 84A69BCA1D8E6635003B5F8F /* Sources */, 95 | 84A69BCB1D8E6635003B5F8F /* Frameworks */, 96 | 84A69BCC1D8E6635003B5F8F /* Resources */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = WebviewMenu; 103 | productName = WebviewMenu; 104 | productReference = 84A69BCE1D8E6635003B5F8F /* WebviewMenu.app */; 105 | productType = "com.apple.product-type.application"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | 84A69BC61D8E6635003B5F8F /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | LastUpgradeCheck = 0800; 114 | ORGANIZATIONNAME = admin; 115 | TargetAttributes = { 116 | 84A69BCD1D8E6635003B5F8F = { 117 | CreatedOnToolsVersion = 8.0; 118 | DevelopmentTeam = L846R6TS7L; 119 | ProvisioningStyle = Automatic; 120 | }; 121 | }; 122 | }; 123 | buildConfigurationList = 84A69BC91D8E6635003B5F8F /* Build configuration list for PBXProject "WebviewMenu" */; 124 | compatibilityVersion = "Xcode 3.2"; 125 | developmentRegion = English; 126 | hasScannedForEncodings = 0; 127 | knownRegions = ( 128 | en, 129 | Base, 130 | ); 131 | mainGroup = 84A69BC51D8E6635003B5F8F; 132 | productRefGroup = 84A69BCF1D8E6635003B5F8F /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | 84A69BCD1D8E6635003B5F8F /* WebviewMenu */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXResourcesBuildPhase section */ 142 | 84A69BCC1D8E6635003B5F8F /* Resources */ = { 143 | isa = PBXResourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 84A69BE11D8E6635003B5F8F /* LaunchScreen.storyboard in Resources */, 147 | 84A69BDE1D8E6635003B5F8F /* Assets.xcassets in Resources */, 148 | 84A69BDC1D8E6635003B5F8F /* Main.storyboard in Resources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXResourcesBuildPhase section */ 153 | 154 | /* Begin PBXSourcesBuildPhase section */ 155 | 84A69BCA1D8E6635003B5F8F /* Sources */ = { 156 | isa = PBXSourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 84A69BD91D8E6635003B5F8F /* ViewController.m in Sources */, 160 | 84A69BD61D8E6635003B5F8F /* AppDelegate.m in Sources */, 161 | 84A69BEA1D8E6650003B5F8F /* CustomWebView.m in Sources */, 162 | 84A69BD31D8E6635003B5F8F /* main.m in Sources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXSourcesBuildPhase section */ 167 | 168 | /* Begin PBXVariantGroup section */ 169 | 84A69BDA1D8E6635003B5F8F /* Main.storyboard */ = { 170 | isa = PBXVariantGroup; 171 | children = ( 172 | 84A69BDB1D8E6635003B5F8F /* Base */, 173 | ); 174 | name = Main.storyboard; 175 | sourceTree = ""; 176 | }; 177 | 84A69BDF1D8E6635003B5F8F /* LaunchScreen.storyboard */ = { 178 | isa = PBXVariantGroup; 179 | children = ( 180 | 84A69BE01D8E6635003B5F8F /* Base */, 181 | ); 182 | name = LaunchScreen.storyboard; 183 | sourceTree = ""; 184 | }; 185 | /* End PBXVariantGroup section */ 186 | 187 | /* Begin XCBuildConfiguration section */ 188 | 84A69BE31D8E6635003B5F8F /* Debug */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | ALWAYS_SEARCH_USER_PATHS = NO; 192 | CLANG_ANALYZER_NONNULL = YES; 193 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 194 | CLANG_CXX_LIBRARY = "libc++"; 195 | CLANG_ENABLE_MODULES = YES; 196 | CLANG_ENABLE_OBJC_ARC = YES; 197 | CLANG_WARN_BOOL_CONVERSION = YES; 198 | CLANG_WARN_CONSTANT_CONVERSION = YES; 199 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 200 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 201 | CLANG_WARN_EMPTY_BODY = YES; 202 | CLANG_WARN_ENUM_CONVERSION = YES; 203 | CLANG_WARN_INFINITE_RECURSION = YES; 204 | CLANG_WARN_INT_CONVERSION = YES; 205 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 206 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 210 | COPY_PHASE_STRIP = NO; 211 | DEBUG_INFORMATION_FORMAT = dwarf; 212 | ENABLE_STRICT_OBJC_MSGSEND = YES; 213 | ENABLE_TESTABILITY = YES; 214 | GCC_C_LANGUAGE_STANDARD = gnu99; 215 | GCC_DYNAMIC_NO_PIC = NO; 216 | GCC_NO_COMMON_BLOCKS = YES; 217 | GCC_OPTIMIZATION_LEVEL = 0; 218 | GCC_PREPROCESSOR_DEFINITIONS = ( 219 | "DEBUG=1", 220 | "$(inherited)", 221 | ); 222 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 223 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 224 | GCC_WARN_UNDECLARED_SELECTOR = YES; 225 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 226 | GCC_WARN_UNUSED_FUNCTION = YES; 227 | GCC_WARN_UNUSED_VARIABLE = YES; 228 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 229 | MTL_ENABLE_DEBUG_INFO = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | }; 233 | name = Debug; 234 | }; 235 | 84A69BE41D8E6635003B5F8F /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | CLANG_ANALYZER_NONNULL = YES; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_CONSTANT_CONVERSION = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 248 | CLANG_WARN_EMPTY_BODY = YES; 249 | CLANG_WARN_ENUM_CONVERSION = YES; 250 | CLANG_WARN_INFINITE_RECURSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 253 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | 84A69BE61D8E6635003B5F8F /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | DEVELOPMENT_TEAM = L846R6TS7L; 281 | INFOPLIST_FILE = WebviewMenu/Info.plist; 282 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 283 | PRODUCT_BUNDLE_IDENTIFIER = com.feheadline.WebviewMenu; 284 | PRODUCT_NAME = "$(TARGET_NAME)"; 285 | }; 286 | name = Debug; 287 | }; 288 | 84A69BE71D8E6635003B5F8F /* Release */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | DEVELOPMENT_TEAM = L846R6TS7L; 293 | INFOPLIST_FILE = WebviewMenu/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 295 | PRODUCT_BUNDLE_IDENTIFIER = com.feheadline.WebviewMenu; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | }; 298 | name = Release; 299 | }; 300 | /* End XCBuildConfiguration section */ 301 | 302 | /* Begin XCConfigurationList section */ 303 | 84A69BC91D8E6635003B5F8F /* Build configuration list for PBXProject "WebviewMenu" */ = { 304 | isa = XCConfigurationList; 305 | buildConfigurations = ( 306 | 84A69BE31D8E6635003B5F8F /* Debug */, 307 | 84A69BE41D8E6635003B5F8F /* Release */, 308 | ); 309 | defaultConfigurationIsVisible = 0; 310 | defaultConfigurationName = Release; 311 | }; 312 | 84A69BE51D8E6635003B5F8F /* Build configuration list for PBXNativeTarget "WebviewMenu" */ = { 313 | isa = XCConfigurationList; 314 | buildConfigurations = ( 315 | 84A69BE61D8E6635003B5F8F /* Debug */, 316 | 84A69BE71D8E6635003B5F8F /* Release */, 317 | ); 318 | defaultConfigurationIsVisible = 0; 319 | }; 320 | /* End XCConfigurationList section */ 321 | }; 322 | rootObject = 84A69BC61D8E6635003B5F8F /* Project object */; 323 | } 324 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dev-zlcode/ZlcodeTips/392971b84760b274f37c806e9133fd263fc8f0f3/WebviewMenu/WebviewMenu.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/WebviewMenu.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WebviewMenu.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 84A69BCD1D8E6635003B5F8F 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // WebviewMenu 4 | // 5 | // Created by admin on 16/9/18. 6 | // Copyright © 2016年 admin. 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 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // WebviewMenu 4 | // 5 | // Created by admin on 16/9/18. 6 | // Copyright © 2016年 admin. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/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 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/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 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/CustomWebView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomWebView.h 3 | // WebviewTest 4 | // 5 | // Created by admin on 16/9/13. 6 | // Copyright © 2016年 admin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CustomWebView : UIWebView 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/CustomWebView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomWebView.m 3 | // WebviewTest 4 | // 5 | // Created by admin on 16/9/13. 6 | // Copyright © 2016年 admin. All rights reserved. 7 | // 8 | 9 | #import "CustomWebView.h" 10 | 11 | @implementation CustomWebView 12 | 13 | -(id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) 17 | { 18 | // 全代码时入口 19 | [self addMenu]; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | -(void)awakeFromNib 26 | { 27 | [super awakeFromNib]; 28 | 29 | // xib时入口 30 | [self addMenu]; 31 | } 32 | 33 | - (void)addMenu 34 | { 35 | UIMenuController *menuController = [UIMenuController sharedMenuController]; 36 | 37 | UIMenuItem *menuItemCopy = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(copyT:)]; 38 | 39 | UIMenuItem *menuItemNote = [[UIMenuItem alloc] initWithTitle:@"笔记" action:@selector(noteT:)]; 40 | 41 | UIMenuItem *menuItemSearch = [[UIMenuItem alloc] initWithTitle:@"搜索" action:@selector(searchT:)]; 42 | 43 | UIMenuItem *menuItemShare = [[UIMenuItem alloc] initWithTitle:@"分享" action:@selector(shareT:)]; 44 | 45 | NSArray *mArray = [NSArray arrayWithObjects:menuItemCopy,menuItemNote,menuItemSearch,menuItemShare,nil]; 46 | [menuController setMenuItems:mArray]; 47 | } 48 | 49 | -(BOOL)canPerformAction:(SEL)action withSender:(id)sender 50 | { 51 | if(action == @selector(copyT:) || action == @selector(noteT:) || action == @selector(searchT:) || action == @selector(shareT:)) 52 | { 53 | return YES; 54 | } 55 | 56 | return NO; 57 | } 58 | 59 | -(void)copyT:(id)sender 60 | { 61 | NSLog(@"复制"); 62 | } 63 | 64 | -(void)noteT:(id)sender 65 | { 66 | NSLog(@"笔记"); 67 | } 68 | 69 | -(void)searchT:(id)sender 70 | { 71 | NSLog(@"搜索"); 72 | } 73 | 74 | -(void)shareT:(id)sender 75 | { 76 | NSLog(@"分享"); 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | UILaunchStoryboardName 29 | LaunchScreen 30 | UIMainStoryboardFile 31 | Main 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // WebviewMenu 4 | // 5 | // Created by admin on 16/9/18. 6 | // Copyright © 2016年 admin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // WebviewMenu 4 | // 5 | // Created by admin on 16/9/18. 6 | // Copyright © 2016年 admin. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "CustomWebView.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | CustomWebView *webview = [CustomWebView new]; 22 | webview.frame = self.view.bounds; 23 | [self.view addSubview:webview]; 24 | NSURL *url = [NSURL URLWithString:@"http://www.feheadline.com/webapp/detail.html?id=3374280"]; 25 | NSURLRequest *req = [[NSURLRequest alloc] initWithURL:url]; 26 | [webview loadRequest:req]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WebviewMenu/WebviewMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WebviewMenu 4 | // 5 | // Created by admin on 16/9/18. 6 | // Copyright © 2016年 admin. 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 | --------------------------------------------------------------------------------