├── .DS_Store ├── .gitignore ├── LICENSE ├── README.md └── ZZJRecord-Demo ├── .DS_Store ├── WechatIMG228.jpeg ├── WechatIMG229.jpeg ├── ZZJRecord-Demo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── ZZJRecord-Demo ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── .DS_Store │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── delete.imageset │ │ ├── Contents.json │ │ ├── delete@2x.png │ │ └── delete@3x.png │ ├── donghua_one.imageset │ │ ├── Contents.json │ │ ├── donghua_one@2x.png │ │ └── donghua_one@3x.png │ ├── donghua_two.imageset │ │ ├── Contents.json │ │ ├── donghua_two@2x.png │ │ └── donghua_two@3x.png │ ├── quxiao.imageset │ │ ├── Contents.json │ │ ├── quxiao@2x.png │ │ └── quxiao@3x.png │ ├── shuohua.imageset │ │ ├── Contents.json │ │ ├── shuohua@2x.png │ │ └── shuohua@3x.png │ ├── voice_bg.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── voice_bg@2x.png │ │ └── voice_bg@3x.png │ ├── yuyin1.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── yuyin1@2x.png │ │ └── yuyin1@3x.png │ ├── yuyin2.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── yuyin2@2x.png │ │ └── yuyin2@3x.png │ ├── yuyin3.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── yuyin3@2x.png │ │ └── yuyin3@3x.png │ └── yuyin4.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── yuyin4@2x.png │ │ └── yuyin4@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Tool │ ├── LVRecordTool.h │ ├── LVRecordTool.m │ ├── UIView+ZZJExtension.h │ └── UIView+ZZJExtension.m ├── View │ ├── ZZJRecordButton.h │ └── ZZJRecordButton.m ├── ViewController.h ├── ViewController.m └── main.m ├── ZZJRecord-DemoTests ├── Info.plist └── ZZJRecord_DemoTests.m └── ZZJRecord-DemoUITests ├── Info.plist └── ZZJRecord_DemoUITests.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 iOScoderZZJ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZZJRecord-Demo 2 | 一个类似于微信的按住说话的录音demo,代码非常通俗易懂,根据按钮的不同状态进行相关的录音业务处理,并且加上了友好的动画 3 | 4 | 个人简书地址http://www.jianshu.com/users/12e0bbb7297b/latest_articles 5 | 6 | #录音中 7 | ![WechatIMG228.jpeg](http://upload-images.jianshu.io/upload_images/1342044-5e8211e661508e11.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 8 | #向控件外滑动手指 9 | ![WechatIMG229.jpeg](http://upload-images.jianshu.io/upload_images/1342044-ebccd34972bdab96.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 10 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/WechatIMG228.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/WechatIMG228.jpeg -------------------------------------------------------------------------------- /ZZJRecord-Demo/WechatIMG229.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/WechatIMG229.jpeg -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0D574C491E10C38D00184D39 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C481E10C38D00184D39 /* main.m */; }; 11 | 0D574C4C1E10C38D00184D39 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C4B1E10C38D00184D39 /* AppDelegate.m */; }; 12 | 0D574C4F1E10C38D00184D39 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C4E1E10C38D00184D39 /* ViewController.m */; }; 13 | 0D574C521E10C38D00184D39 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D574C501E10C38D00184D39 /* Main.storyboard */; }; 14 | 0D574C541E10C38D00184D39 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0D574C531E10C38D00184D39 /* Assets.xcassets */; }; 15 | 0D574C571E10C38D00184D39 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D574C551E10C38D00184D39 /* LaunchScreen.storyboard */; }; 16 | 0D574C621E10C38D00184D39 /* ZZJRecord_DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C611E10C38D00184D39 /* ZZJRecord_DemoTests.m */; }; 17 | 0D574C6D1E10C38D00184D39 /* ZZJRecord_DemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C6C1E10C38D00184D39 /* ZZJRecord_DemoUITests.m */; }; 18 | 0D574C7D1E10C48500184D39 /* LVRecordTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C7C1E10C48500184D39 /* LVRecordTool.m */; }; 19 | 0D574C811E10C56400184D39 /* ZZJRecordButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C801E10C56400184D39 /* ZZJRecordButton.m */; }; 20 | 0D574C871E10C9AA00184D39 /* UIView+ZZJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D574C861E10C9AA00184D39 /* UIView+ZZJExtension.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 0D574C5E1E10C38D00184D39 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 0D574C3C1E10C38C00184D39 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 0D574C431E10C38C00184D39; 29 | remoteInfo = "ZZJRecord-Demo"; 30 | }; 31 | 0D574C691E10C38D00184D39 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 0D574C3C1E10C38C00184D39 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 0D574C431E10C38C00184D39; 36 | remoteInfo = "ZZJRecord-Demo"; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 0D574C441E10C38C00184D39 /* ZZJRecord-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ZZJRecord-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 0D574C481E10C38D00184D39 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 0D574C4A1E10C38D00184D39 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | 0D574C4B1E10C38D00184D39 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | 0D574C4D1E10C38D00184D39 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | 0D574C4E1E10C38D00184D39 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | 0D574C511E10C38D00184D39 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 0D574C531E10C38D00184D39 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 0D574C561E10C38D00184D39 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 0D574C581E10C38D00184D39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 0D574C5D1E10C38D00184D39 /* ZZJRecord-DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ZZJRecord-DemoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 0D574C611E10C38D00184D39 /* ZZJRecord_DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZZJRecord_DemoTests.m; sourceTree = ""; }; 53 | 0D574C631E10C38D00184D39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 0D574C681E10C38D00184D39 /* ZZJRecord-DemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ZZJRecord-DemoUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 0D574C6C1E10C38D00184D39 /* ZZJRecord_DemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZZJRecord_DemoUITests.m; sourceTree = ""; }; 56 | 0D574C6E1E10C38D00184D39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 0D574C7B1E10C47A00184D39 /* LVRecordTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVRecordTool.h; sourceTree = ""; }; 58 | 0D574C7C1E10C48500184D39 /* LVRecordTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVRecordTool.m; sourceTree = ""; }; 59 | 0D574C7F1E10C56400184D39 /* ZZJRecordButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZZJRecordButton.h; sourceTree = ""; }; 60 | 0D574C801E10C56400184D39 /* ZZJRecordButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZZJRecordButton.m; sourceTree = ""; }; 61 | 0D574C851E10C9AA00184D39 /* UIView+ZZJExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ZZJExtension.h"; sourceTree = ""; }; 62 | 0D574C861E10C9AA00184D39 /* UIView+ZZJExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ZZJExtension.m"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 0D574C411E10C38C00184D39 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 0D574C5A1E10C38D00184D39 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 0D574C651E10C38D00184D39 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 0D574C3B1E10C38C00184D39 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 0D574C461E10C38C00184D39 /* ZZJRecord-Demo */, 94 | 0D574C601E10C38D00184D39 /* ZZJRecord-DemoTests */, 95 | 0D574C6B1E10C38D00184D39 /* ZZJRecord-DemoUITests */, 96 | 0D574C451E10C38C00184D39 /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 0D574C451E10C38C00184D39 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 0D574C441E10C38C00184D39 /* ZZJRecord-Demo.app */, 104 | 0D574C5D1E10C38D00184D39 /* ZZJRecord-DemoTests.xctest */, 105 | 0D574C681E10C38D00184D39 /* ZZJRecord-DemoUITests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 0D574C461E10C38C00184D39 /* ZZJRecord-Demo */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 0D574C7E1E10C54E00184D39 /* View */, 114 | 0D574C7A1E10C41400184D39 /* Tool */, 115 | 0D574C4A1E10C38D00184D39 /* AppDelegate.h */, 116 | 0D574C4B1E10C38D00184D39 /* AppDelegate.m */, 117 | 0D574C4D1E10C38D00184D39 /* ViewController.h */, 118 | 0D574C4E1E10C38D00184D39 /* ViewController.m */, 119 | 0D574C501E10C38D00184D39 /* Main.storyboard */, 120 | 0D574C531E10C38D00184D39 /* Assets.xcassets */, 121 | 0D574C551E10C38D00184D39 /* LaunchScreen.storyboard */, 122 | 0D574C581E10C38D00184D39 /* Info.plist */, 123 | 0D574C471E10C38D00184D39 /* Supporting Files */, 124 | ); 125 | path = "ZZJRecord-Demo"; 126 | sourceTree = ""; 127 | }; 128 | 0D574C471E10C38D00184D39 /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 0D574C481E10C38D00184D39 /* main.m */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | 0D574C601E10C38D00184D39 /* ZZJRecord-DemoTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 0D574C611E10C38D00184D39 /* ZZJRecord_DemoTests.m */, 140 | 0D574C631E10C38D00184D39 /* Info.plist */, 141 | ); 142 | path = "ZZJRecord-DemoTests"; 143 | sourceTree = ""; 144 | }; 145 | 0D574C6B1E10C38D00184D39 /* ZZJRecord-DemoUITests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 0D574C6C1E10C38D00184D39 /* ZZJRecord_DemoUITests.m */, 149 | 0D574C6E1E10C38D00184D39 /* Info.plist */, 150 | ); 151 | path = "ZZJRecord-DemoUITests"; 152 | sourceTree = ""; 153 | }; 154 | 0D574C7A1E10C41400184D39 /* Tool */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 0D574C7B1E10C47A00184D39 /* LVRecordTool.h */, 158 | 0D574C7C1E10C48500184D39 /* LVRecordTool.m */, 159 | 0D574C851E10C9AA00184D39 /* UIView+ZZJExtension.h */, 160 | 0D574C861E10C9AA00184D39 /* UIView+ZZJExtension.m */, 161 | ); 162 | path = Tool; 163 | sourceTree = ""; 164 | }; 165 | 0D574C7E1E10C54E00184D39 /* View */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 0D574C7F1E10C56400184D39 /* ZZJRecordButton.h */, 169 | 0D574C801E10C56400184D39 /* ZZJRecordButton.m */, 170 | ); 171 | path = View; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXGroup section */ 175 | 176 | /* Begin PBXNativeTarget section */ 177 | 0D574C431E10C38C00184D39 /* ZZJRecord-Demo */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 0D574C711E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-Demo" */; 180 | buildPhases = ( 181 | 0D574C401E10C38C00184D39 /* Sources */, 182 | 0D574C411E10C38C00184D39 /* Frameworks */, 183 | 0D574C421E10C38C00184D39 /* Resources */, 184 | ); 185 | buildRules = ( 186 | ); 187 | dependencies = ( 188 | ); 189 | name = "ZZJRecord-Demo"; 190 | productName = "ZZJRecord-Demo"; 191 | productReference = 0D574C441E10C38C00184D39 /* ZZJRecord-Demo.app */; 192 | productType = "com.apple.product-type.application"; 193 | }; 194 | 0D574C5C1E10C38D00184D39 /* ZZJRecord-DemoTests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 0D574C741E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-DemoTests" */; 197 | buildPhases = ( 198 | 0D574C591E10C38D00184D39 /* Sources */, 199 | 0D574C5A1E10C38D00184D39 /* Frameworks */, 200 | 0D574C5B1E10C38D00184D39 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 0D574C5F1E10C38D00184D39 /* PBXTargetDependency */, 206 | ); 207 | name = "ZZJRecord-DemoTests"; 208 | productName = "ZZJRecord-DemoTests"; 209 | productReference = 0D574C5D1E10C38D00184D39 /* ZZJRecord-DemoTests.xctest */; 210 | productType = "com.apple.product-type.bundle.unit-test"; 211 | }; 212 | 0D574C671E10C38D00184D39 /* ZZJRecord-DemoUITests */ = { 213 | isa = PBXNativeTarget; 214 | buildConfigurationList = 0D574C771E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-DemoUITests" */; 215 | buildPhases = ( 216 | 0D574C641E10C38D00184D39 /* Sources */, 217 | 0D574C651E10C38D00184D39 /* Frameworks */, 218 | 0D574C661E10C38D00184D39 /* Resources */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | 0D574C6A1E10C38D00184D39 /* PBXTargetDependency */, 224 | ); 225 | name = "ZZJRecord-DemoUITests"; 226 | productName = "ZZJRecord-DemoUITests"; 227 | productReference = 0D574C681E10C38D00184D39 /* ZZJRecord-DemoUITests.xctest */; 228 | productType = "com.apple.product-type.bundle.ui-testing"; 229 | }; 230 | /* End PBXNativeTarget section */ 231 | 232 | /* Begin PBXProject section */ 233 | 0D574C3C1E10C38C00184D39 /* Project object */ = { 234 | isa = PBXProject; 235 | attributes = { 236 | LastUpgradeCheck = 0730; 237 | ORGANIZATIONNAME = chefuzzj; 238 | TargetAttributes = { 239 | 0D574C431E10C38C00184D39 = { 240 | CreatedOnToolsVersion = 7.3.1; 241 | }; 242 | 0D574C5C1E10C38D00184D39 = { 243 | CreatedOnToolsVersion = 7.3.1; 244 | TestTargetID = 0D574C431E10C38C00184D39; 245 | }; 246 | 0D574C671E10C38D00184D39 = { 247 | CreatedOnToolsVersion = 7.3.1; 248 | TestTargetID = 0D574C431E10C38C00184D39; 249 | }; 250 | }; 251 | }; 252 | buildConfigurationList = 0D574C3F1E10C38C00184D39 /* Build configuration list for PBXProject "ZZJRecord-Demo" */; 253 | compatibilityVersion = "Xcode 3.2"; 254 | developmentRegion = English; 255 | hasScannedForEncodings = 0; 256 | knownRegions = ( 257 | en, 258 | Base, 259 | ); 260 | mainGroup = 0D574C3B1E10C38C00184D39; 261 | productRefGroup = 0D574C451E10C38C00184D39 /* Products */; 262 | projectDirPath = ""; 263 | projectRoot = ""; 264 | targets = ( 265 | 0D574C431E10C38C00184D39 /* ZZJRecord-Demo */, 266 | 0D574C5C1E10C38D00184D39 /* ZZJRecord-DemoTests */, 267 | 0D574C671E10C38D00184D39 /* ZZJRecord-DemoUITests */, 268 | ); 269 | }; 270 | /* End PBXProject section */ 271 | 272 | /* Begin PBXResourcesBuildPhase section */ 273 | 0D574C421E10C38C00184D39 /* Resources */ = { 274 | isa = PBXResourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 0D574C571E10C38D00184D39 /* LaunchScreen.storyboard in Resources */, 278 | 0D574C541E10C38D00184D39 /* Assets.xcassets in Resources */, 279 | 0D574C521E10C38D00184D39 /* Main.storyboard in Resources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | 0D574C5B1E10C38D00184D39 /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 0D574C661E10C38D00184D39 /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXResourcesBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 0D574C401E10C38C00184D39 /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 0D574C7D1E10C48500184D39 /* LVRecordTool.m in Sources */, 305 | 0D574C871E10C9AA00184D39 /* UIView+ZZJExtension.m in Sources */, 306 | 0D574C4F1E10C38D00184D39 /* ViewController.m in Sources */, 307 | 0D574C4C1E10C38D00184D39 /* AppDelegate.m in Sources */, 308 | 0D574C491E10C38D00184D39 /* main.m in Sources */, 309 | 0D574C811E10C56400184D39 /* ZZJRecordButton.m in Sources */, 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | 0D574C591E10C38D00184D39 /* Sources */ = { 314 | isa = PBXSourcesBuildPhase; 315 | buildActionMask = 2147483647; 316 | files = ( 317 | 0D574C621E10C38D00184D39 /* ZZJRecord_DemoTests.m in Sources */, 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | 0D574C641E10C38D00184D39 /* Sources */ = { 322 | isa = PBXSourcesBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | 0D574C6D1E10C38D00184D39 /* ZZJRecord_DemoUITests.m in Sources */, 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | /* End PBXSourcesBuildPhase section */ 330 | 331 | /* Begin PBXTargetDependency section */ 332 | 0D574C5F1E10C38D00184D39 /* PBXTargetDependency */ = { 333 | isa = PBXTargetDependency; 334 | target = 0D574C431E10C38C00184D39 /* ZZJRecord-Demo */; 335 | targetProxy = 0D574C5E1E10C38D00184D39 /* PBXContainerItemProxy */; 336 | }; 337 | 0D574C6A1E10C38D00184D39 /* PBXTargetDependency */ = { 338 | isa = PBXTargetDependency; 339 | target = 0D574C431E10C38C00184D39 /* ZZJRecord-Demo */; 340 | targetProxy = 0D574C691E10C38D00184D39 /* PBXContainerItemProxy */; 341 | }; 342 | /* End PBXTargetDependency section */ 343 | 344 | /* Begin PBXVariantGroup section */ 345 | 0D574C501E10C38D00184D39 /* Main.storyboard */ = { 346 | isa = PBXVariantGroup; 347 | children = ( 348 | 0D574C511E10C38D00184D39 /* Base */, 349 | ); 350 | name = Main.storyboard; 351 | sourceTree = ""; 352 | }; 353 | 0D574C551E10C38D00184D39 /* LaunchScreen.storyboard */ = { 354 | isa = PBXVariantGroup; 355 | children = ( 356 | 0D574C561E10C38D00184D39 /* Base */, 357 | ); 358 | name = LaunchScreen.storyboard; 359 | sourceTree = ""; 360 | }; 361 | /* End PBXVariantGroup section */ 362 | 363 | /* Begin XCBuildConfiguration section */ 364 | 0D574C6F1E10C38D00184D39 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_ANALYZER_NONNULL = YES; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_UNREACHABLE_CODE = YES; 381 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 382 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 383 | COPY_PHASE_STRIP = NO; 384 | DEBUG_INFORMATION_FORMAT = dwarf; 385 | ENABLE_STRICT_OBJC_MSGSEND = YES; 386 | ENABLE_TESTABILITY = YES; 387 | GCC_C_LANGUAGE_STANDARD = gnu99; 388 | GCC_DYNAMIC_NO_PIC = NO; 389 | GCC_NO_COMMON_BLOCKS = YES; 390 | GCC_OPTIMIZATION_LEVEL = 0; 391 | GCC_PREPROCESSOR_DEFINITIONS = ( 392 | "DEBUG=1", 393 | "$(inherited)", 394 | ); 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 402 | MTL_ENABLE_DEBUG_INFO = YES; 403 | ONLY_ACTIVE_ARCH = YES; 404 | SDKROOT = iphoneos; 405 | }; 406 | name = Debug; 407 | }; 408 | 0D574C701E10C38D00184D39 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ALWAYS_SEARCH_USER_PATHS = NO; 412 | CLANG_ANALYZER_NONNULL = YES; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_CONSTANT_CONVERSION = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 427 | COPY_PHASE_STRIP = NO; 428 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 429 | ENABLE_NS_ASSERTIONS = NO; 430 | ENABLE_STRICT_OBJC_MSGSEND = YES; 431 | GCC_C_LANGUAGE_STANDARD = gnu99; 432 | GCC_NO_COMMON_BLOCKS = YES; 433 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 434 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 435 | GCC_WARN_UNDECLARED_SELECTOR = YES; 436 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 437 | GCC_WARN_UNUSED_FUNCTION = YES; 438 | GCC_WARN_UNUSED_VARIABLE = YES; 439 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 440 | MTL_ENABLE_DEBUG_INFO = NO; 441 | SDKROOT = iphoneos; 442 | VALIDATE_PRODUCT = YES; 443 | }; 444 | name = Release; 445 | }; 446 | 0D574C721E10C38D00184D39 /* Debug */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 450 | INFOPLIST_FILE = "ZZJRecord-Demo/Info.plist"; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-Demo"; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | }; 455 | name = Debug; 456 | }; 457 | 0D574C731E10C38D00184D39 /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | INFOPLIST_FILE = "ZZJRecord-Demo/Info.plist"; 462 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 463 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-Demo"; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | }; 466 | name = Release; 467 | }; 468 | 0D574C751E10C38D00184D39 /* Debug */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | BUNDLE_LOADER = "$(TEST_HOST)"; 472 | INFOPLIST_FILE = "ZZJRecord-DemoTests/Info.plist"; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 474 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-DemoTests"; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZZJRecord-Demo.app/ZZJRecord-Demo"; 477 | }; 478 | name = Debug; 479 | }; 480 | 0D574C761E10C38D00184D39 /* Release */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | BUNDLE_LOADER = "$(TEST_HOST)"; 484 | INFOPLIST_FILE = "ZZJRecord-DemoTests/Info.plist"; 485 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 486 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-DemoTests"; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZZJRecord-Demo.app/ZZJRecord-Demo"; 489 | }; 490 | name = Release; 491 | }; 492 | 0D574C781E10C38D00184D39 /* Debug */ = { 493 | isa = XCBuildConfiguration; 494 | buildSettings = { 495 | INFOPLIST_FILE = "ZZJRecord-DemoUITests/Info.plist"; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 497 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-DemoUITests"; 498 | PRODUCT_NAME = "$(TARGET_NAME)"; 499 | TEST_TARGET_NAME = "ZZJRecord-Demo"; 500 | }; 501 | name = Debug; 502 | }; 503 | 0D574C791E10C38D00184D39 /* Release */ = { 504 | isa = XCBuildConfiguration; 505 | buildSettings = { 506 | INFOPLIST_FILE = "ZZJRecord-DemoUITests/Info.plist"; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 508 | PRODUCT_BUNDLE_IDENTIFIER = "chefu.ZZJRecord-DemoUITests"; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | TEST_TARGET_NAME = "ZZJRecord-Demo"; 511 | }; 512 | name = Release; 513 | }; 514 | /* End XCBuildConfiguration section */ 515 | 516 | /* Begin XCConfigurationList section */ 517 | 0D574C3F1E10C38C00184D39 /* Build configuration list for PBXProject "ZZJRecord-Demo" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 0D574C6F1E10C38D00184D39 /* Debug */, 521 | 0D574C701E10C38D00184D39 /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 0D574C711E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-Demo" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 0D574C721E10C38D00184D39 /* Debug */, 530 | 0D574C731E10C38D00184D39 /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | }; 534 | 0D574C741E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-DemoTests" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | 0D574C751E10C38D00184D39 /* Debug */, 538 | 0D574C761E10C38D00184D39 /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | }; 542 | 0D574C771E10C38D00184D39 /* Build configuration list for PBXNativeTarget "ZZJRecord-DemoUITests" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | 0D574C781E10C38D00184D39 /* Debug */, 546 | 0D574C791E10C38D00184D39 /* Release */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | }; 550 | /* End XCConfigurationList section */ 551 | }; 552 | rootObject = 0D574C3C1E10C38C00184D39 /* Project object */; 553 | } 554 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. 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 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. 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 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/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 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/delete.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "delete@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "delete@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/delete.imageset/delete@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/delete.imageset/delete@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/delete.imageset/delete@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/delete.imageset/delete@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_one.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "donghua_one@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "donghua_one@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_one.imageset/donghua_one@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_one.imageset/donghua_one@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_one.imageset/donghua_one@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_one.imageset/donghua_one@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_two.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "donghua_two@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "donghua_two@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_two.imageset/donghua_two@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_two.imageset/donghua_two@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_two.imageset/donghua_two@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/donghua_two.imageset/donghua_two@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/quxiao.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "quxiao@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "quxiao@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/quxiao.imageset/quxiao@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/quxiao.imageset/quxiao@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/quxiao.imageset/quxiao@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/quxiao.imageset/quxiao@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/shuohua.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "shuohua@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "shuohua@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/shuohua.imageset/shuohua@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/shuohua.imageset/shuohua@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/shuohua.imageset/shuohua@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/shuohua.imageset/shuohua@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "voice_bg@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "voice_bg@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/voice_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/voice_bg@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/voice_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/voice_bg.imageset/voice_bg@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "yuyin1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "yuyin1@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/yuyin1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/yuyin1@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/yuyin1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin1.imageset/yuyin1@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "yuyin2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "yuyin2@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/yuyin2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/yuyin2@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/yuyin2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin2.imageset/yuyin2@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "yuyin3@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "yuyin3@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/yuyin3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/yuyin3@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/yuyin3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin3.imageset/yuyin3@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/.DS_Store -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "yuyin4@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "yuyin4@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/yuyin4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/yuyin4@2x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/yuyin4@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOScoderZZJ/ZZJRecord-Demo/953b40f11992868b24ecbe578dbf0165503cb40a/ZZJRecord-Demo/ZZJRecord-Demo/Assets.xcassets/yuyin4.imageset/yuyin4@3x.png -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/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 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/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 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Tool/LVRecordTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // LVRecordTool.h 3 | // RecordAndPlayVoice 4 | // 5 | // Created by PBOC CS on 15/3/14. 6 | // Copyright (c) 2015年 liuchunlao. All rights reserved. 7 | // 8 | 9 | /// 非常好用的一个录音工具类,从网络上找到的,原作者见上面的简介,感谢开源的技术分享,我在原来的工具类基础上增加了录音播放完成的回调 10 | 11 | #import 12 | #import 13 | 14 | @class LVRecordTool; 15 | @protocol LVRecordToolDelegate 16 | 17 | @optional 18 | - (void)recordTool:(LVRecordTool *)recordTool didstartRecoring:(int)no; 19 | - (void)recordToolDidFinishPlay:(LVRecordTool *)recordTool; 20 | @end 21 | 22 | @interface LVRecordTool : NSObject 23 | 24 | /** 录音工具的单例 */ 25 | + (instancetype)sharedRecordTool; 26 | 27 | /** 开始录音 */ 28 | - (void)startRecording; 29 | 30 | /** 停止录音 */ 31 | - (void)stopRecording; 32 | 33 | /** 播放录音文件 */ 34 | - (void)playRecordingFile; 35 | 36 | /** 停止播放录音文件 */ 37 | - (void)stopPlaying; 38 | 39 | /** 销毁录音文件 */ 40 | - (void)destructionRecordingFile; 41 | 42 | /** 录音对象 */ 43 | @property (nonatomic, strong) AVAudioRecorder *recorder; 44 | /** 播放器对象 */ 45 | @property (nonatomic, strong) AVAudioPlayer *player; 46 | 47 | 48 | /** 更新图片的代理 */ 49 | @property (nonatomic, assign) id delegate; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Tool/LVRecordTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // LVRecordTool.m 3 | // RecordAndPlayVoice 4 | // 5 | // Created by PBOC CS on 15/3/14. 6 | // Copyright (c) 2015年 liuchunlao. All rights reserved. 7 | // 8 | 9 | #define LVRecordFielName @"lvRecord.wav" 10 | 11 | #import "LVRecordTool.h" 12 | 13 | @interface LVRecordTool () 14 | 15 | 16 | 17 | /** 录音文件地址 */ 18 | @property (nonatomic, strong) NSURL *recordFileUrl; 19 | 20 | /** 定时器 */ 21 | @property (nonatomic, strong) NSTimer *timer; 22 | 23 | @property (nonatomic, strong) AVAudioSession *session; 24 | 25 | @end 26 | 27 | @implementation LVRecordTool 28 | 29 | - (void)startRecording { 30 | // 录音时停止播放 删除曾经生成的文件 31 | [self stopPlaying]; 32 | [self destructionRecordingFile]; 33 | 34 | // 真机环境下需要的代码 35 | AVAudioSession *session = [AVAudioSession sharedInstance]; 36 | NSError *sessionError; 37 | [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&sessionError]; 38 | 39 | if(session == nil) 40 | NSLog(@"Error creating session: %@", [sessionError description]); 41 | else 42 | [session setActive:YES error:nil]; 43 | 44 | self.session = session; 45 | 46 | [self.recorder record]; 47 | 48 | 49 | } 50 | 51 | - (void)updateImage { 52 | 53 | [self.recorder updateMeters]; 54 | double lowPassResults = pow(10, (0.05 * [self.recorder peakPowerForChannel:0])); 55 | float result = 10 * (float)lowPassResults; 56 | //NSLog(@"%f", result); 57 | int no = 0; 58 | if (result > 0 && result <= 1.3) { 59 | no = 1; 60 | } else if (result > 1.3 && result <= 2) { 61 | no = 2; 62 | } else if (result > 2 && result <= 3.0) { 63 | no = 3; 64 | } else if (result > 3.0 && result <= 3.0) { 65 | no = 4; 66 | } else if (result > 5.0 && result <= 10) { 67 | no = 5; 68 | } else if (result > 10 && result <= 40) { 69 | no = 6; 70 | } else if (result > 40) { 71 | no = 7; 72 | } 73 | 74 | if ([self.delegate respondsToSelector:@selector(recordTool:didstartRecoring:)]) { 75 | [self.delegate recordTool:self didstartRecoring: no]; 76 | } 77 | } 78 | 79 | - (void)stopRecording { 80 | if ([self.recorder isRecording]) { 81 | [self.recorder stop]; 82 | [self.timer invalidate]; 83 | } 84 | } 85 | 86 | - (void)playRecordingFile { 87 | // 播放时停止录音 88 | [self.recorder stop]; 89 | 90 | // 正在播放就返回 91 | if ([self.player isPlaying]) return; 92 | NSError * error; 93 | self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:self.recordFileUrl error:&error]; 94 | self.player.delegate = self; 95 | 96 | [self.session setCategory:AVAudioSessionCategoryPlayback error:nil]; 97 | 98 | [self.player play]; 99 | } 100 | 101 | - (void)stopPlaying { 102 | [self.player stop]; 103 | } 104 | 105 | static id instance; 106 | #pragma mark - 单例 107 | + (instancetype)sharedRecordTool { 108 | static dispatch_once_t onceToken; 109 | dispatch_once(&onceToken, ^{ 110 | if (instance == nil) { 111 | instance = [[self alloc] init]; 112 | } 113 | }); 114 | return instance; 115 | } 116 | 117 | + (instancetype)allocWithZone:(struct _NSZone *)zone { 118 | static dispatch_once_t onceToken; 119 | dispatch_once(&onceToken, ^{ 120 | if (instance == nil) { 121 | instance = [super allocWithZone:zone]; 122 | } 123 | }); 124 | return instance; 125 | } 126 | 127 | #pragma mark - 懒加载 128 | - (AVAudioRecorder *)recorder { 129 | if (!_recorder) { 130 | 131 | // 1.获取沙盒地址 132 | NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 133 | NSString *filePath = [path stringByAppendingPathComponent:LVRecordFielName]; 134 | self.recordFileUrl = [NSURL fileURLWithPath:filePath]; 135 | NSLog(@"%@", filePath); 136 | 137 | // 3.设置录音的一些参数 138 | NSMutableDictionary *setting = [NSMutableDictionary dictionary]; 139 | // 音频格式 140 | setting[AVFormatIDKey] = @(kAudioFormatLinearPCM); 141 | // 录音采样率(Hz) 如:AVSampleRateKey==8000/44100/96000(影响音频的质量) 142 | setting[AVSampleRateKey] = @(16000.0); 143 | // 音频通道数 1 或 2 144 | setting[AVNumberOfChannelsKey] = @(1); 145 | // 线性音频的位深度 8、16、24、32 146 | setting[AVLinearPCMBitDepthKey] = @(16); 147 | //录音的质量 148 | setting[AVEncoderAudioQualityKey] = [NSNumber numberWithInt:AVAudioQualityHigh]; 149 | 150 | _recorder = [[AVAudioRecorder alloc] initWithURL:self.recordFileUrl settings:setting error:NULL]; 151 | _recorder.delegate = self; 152 | _recorder.meteringEnabled = YES; 153 | 154 | [_recorder prepareToRecord]; 155 | } 156 | return _recorder; 157 | } 158 | 159 | - (void)destructionRecordingFile { 160 | 161 | NSFileManager *fileManager = [NSFileManager defaultManager]; 162 | if (self.recordFileUrl) { 163 | [fileManager removeItemAtURL:self.recordFileUrl error:NULL]; 164 | } 165 | } 166 | 167 | #pragma mark - AVAudioRecorderDelegate 168 | - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag { 169 | if (flag) { 170 | [self.session setActive:NO error:nil]; 171 | } 172 | } 173 | #pragma mark - AVAudioPlayerDelegate 174 | - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag 175 | { 176 | if ([self.delegate respondsToSelector:@selector(recordToolDidFinishPlay:)]) { 177 | [self.delegate recordToolDidFinishPlay:self]; 178 | } 179 | } 180 | @end 181 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Tool/UIView+ZZJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ZZJExtension.h 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (ZZJExtension) 12 | @property (nonatomic,assign) CGSize size; 13 | @property (nonatomic,assign) CGFloat width; 14 | @property (nonatomic,assign) CGFloat height; 15 | @property (nonatomic,assign) CGFloat x; 16 | @property (nonatomic,assign) CGFloat y; 17 | @property (nonatomic,assign) CGFloat centerX; 18 | @property (nonatomic,assign) CGFloat centerY; 19 | @end 20 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/Tool/UIView+ZZJExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ZZJExtension.m 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import "UIView+ZZJExtension.h" 10 | 11 | @implementation UIView (ZZJExtension) 12 | -(void)setSize:(CGSize)size 13 | { 14 | CGRect frame = self.frame; 15 | frame.size = size; 16 | self.frame = frame; 17 | } 18 | 19 | -(void)setWidth:(CGFloat)width 20 | { 21 | CGRect frame = self.frame; 22 | frame.size.width = width; 23 | self.frame = frame; 24 | } 25 | -(void)setHeight:(CGFloat)height 26 | { 27 | CGRect frame = self.frame; 28 | frame.size.height = height; 29 | self.frame = frame; 30 | } 31 | -(void)setX:(CGFloat)x 32 | { 33 | CGRect frame = self.frame; 34 | frame.origin.x = x; 35 | self.frame = frame; 36 | } 37 | -(void)setY:(CGFloat)y 38 | { 39 | CGRect frame = self.frame; 40 | frame.origin.y = y; 41 | self.frame = frame; 42 | } 43 | -(void)setCenterX:(CGFloat)centerX 44 | { 45 | CGPoint center = self.center; 46 | center.x = centerX; 47 | self.center = center; 48 | } 49 | -(void)setCenterY:(CGFloat)centerY 50 | { 51 | CGPoint center = self.center; 52 | center.y = centerY; 53 | self.center = center; 54 | } 55 | 56 | 57 | -(CGFloat)centerX 58 | { 59 | return self.center.x; 60 | } 61 | -(CGFloat)centerY 62 | { 63 | return self.center.y; 64 | } 65 | -(CGSize)size 66 | { 67 | return self.frame.size; 68 | } 69 | -(CGFloat)width 70 | { 71 | return self.frame.size.width; 72 | } 73 | -(CGFloat)height 74 | { 75 | return self.frame.size.height; 76 | } 77 | -(CGFloat)x 78 | { 79 | return self.frame.origin.x; 80 | } 81 | -(CGFloat)y 82 | { 83 | return self.frame.origin.y; 84 | } 85 | @end 86 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/View/ZZJRecordButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZZJRecordButton.h 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ZZJRecordButton; 12 | 13 | typedef void (^RecordTouchDown) (ZZJRecordButton *recordButton); 14 | typedef void (^RecordTouchUpOutside) (ZZJRecordButton *recordButton); 15 | typedef void (^RecordTouchUpInside) (ZZJRecordButton *recordButton); 16 | typedef void (^RecordTouchDragEnter) (ZZJRecordButton *recordButton); 17 | typedef void (^RecordTouchDragInside) (ZZJRecordButton *recordButton); 18 | typedef void (^RecordTouchDragOutside) (ZZJRecordButton *recordButton); 19 | typedef void (^RecordTouchDragExit) (ZZJRecordButton *recordButton); 20 | 21 | @interface ZZJRecordButton : UIButton 22 | 23 | @property (nonatomic, copy) RecordTouchDown recordTouchDownAction; 24 | @property (nonatomic, copy) RecordTouchUpOutside recordTouchUpOutsideAction; 25 | @property (nonatomic, copy) RecordTouchUpInside recordTouchUpInsideAction; 26 | @property (nonatomic, copy) RecordTouchDragEnter recordTouchDragEnterAction; 27 | @property (nonatomic, copy) RecordTouchDragInside recordTouchDragInsideAction; 28 | @property (nonatomic, copy) RecordTouchDragOutside recordTouchDragOutsideAction; 29 | @property (nonatomic, copy) RecordTouchDragExit recordTouchDragExitAction; 30 | 31 | - (void)setButtonStateWithRecording; 32 | - (void)setButtonStateWithNormal; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/View/ZZJRecordButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZZJRecordButton.m 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import "ZZJRecordButton.h" 10 | #define ZZJRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] 11 | @implementation ZZJRecordButton 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | 18 | 19 | [self addTarget:self action:@selector(recordTouchDown) forControlEvents:UIControlEventTouchDown]; 20 | [self addTarget:self action:@selector(recordTouchUpOutside) forControlEvents:UIControlEventTouchUpOutside]; 21 | [self addTarget:self action:@selector(recordTouchUpInside) forControlEvents:UIControlEventTouchUpInside]; 22 | [self addTarget:self action:@selector(recordTouchDragEnter) forControlEvents:UIControlEventTouchDragEnter]; 23 | [self addTarget:self action:@selector(recordTouchDragInside) forControlEvents:UIControlEventTouchDragInside]; 24 | [self addTarget:self action:@selector(recordTouchDragOutside) forControlEvents:UIControlEventTouchDragOutside]; 25 | [self addTarget:self action:@selector(recordTouchDragExit) forControlEvents:UIControlEventTouchDragExit]; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)setButtonStateWithRecording 31 | { 32 | self.backgroundColor = ZZJRGBColor(181, 14, 30); 33 | [self setTitle:@"松开 结束" forState:UIControlStateNormal]; 34 | } 35 | 36 | - (void)setButtonStateWithNormal 37 | { 38 | self.backgroundColor = [UIColor redColor]; 39 | [self setTitle:@"按住 说话" forState:UIControlStateNormal]; 40 | } 41 | 42 | 43 | #pragma mark -- 事件方法回调 44 | - (void)recordTouchDown 45 | { 46 | if (self.recordTouchDownAction) { 47 | self.recordTouchDownAction(self); 48 | } 49 | } 50 | 51 | - (void)recordTouchUpOutside 52 | { 53 | if (self.recordTouchUpOutsideAction) { 54 | self.recordTouchUpOutsideAction(self); 55 | } 56 | } 57 | 58 | - (void)recordTouchUpInside 59 | { 60 | if (self.recordTouchUpInsideAction) { 61 | self.recordTouchUpInsideAction(self); 62 | } 63 | } 64 | 65 | - (void)recordTouchDragEnter 66 | { 67 | if (self.recordTouchDragEnterAction) { 68 | self.recordTouchDragEnterAction(self); 69 | } 70 | } 71 | 72 | - (void)recordTouchDragInside 73 | { 74 | if (self.recordTouchDragInsideAction) { 75 | self.recordTouchDragInsideAction(self); 76 | } 77 | } 78 | 79 | - (void)recordTouchDragOutside 80 | { 81 | if (self.recordTouchDragOutsideAction) { 82 | self.recordTouchDragOutsideAction(self); 83 | } 84 | } 85 | 86 | - (void)recordTouchDragExit 87 | { 88 | if (self.recordTouchDragExitAction) { 89 | self.recordTouchDragExitAction(self); 90 | } 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | /** 10 | * 代码还有很大的封装空间,可以根据自己的业务逻辑去编写,我测试了很多次,没什么大问题,如有问题望及时纠正 11 | * github地址: https://github.com/iOScoderZZJ 12 | * 简书地址: http://www.jianshu.com/users/12e0bbb7297b/latest_articles 13 | */ 14 | 15 | 16 | #import "ViewController.h" 17 | #import "LVRecordTool.h" 18 | #import "ZZJRecordButton.h" 19 | #import "UIView+ZZJExtension.h" 20 | #define LVRecordFielName @"lvRecord.wav" 21 | #define ZZJScreenW [UIScreen mainScreen].bounds.size.width 22 | #define ZZJScreenH [UIScreen mainScreen].bounds.size.height 23 | @interface ViewController () 24 | @property (nonatomic,weak)ZZJRecordButton * recordButton; 25 | //录音工具类 26 | @property(nonatomic,strong)LVRecordTool * recordTool; 27 | //音频时长 28 | @property(nonatomic,assign)CGFloat currentRecordTime; 29 | 30 | //录音时 提示的相关view 31 | @property(nonatomic,weak)UIImageView * bgView; 32 | @property(nonatomic,weak)UIImageView * stateImageView; 33 | @property(nonatomic,weak)UILabel * textLabel; 34 | 35 | 36 | //显示喇叭 37 | @property (nonatomic,strong)UIButton * voiceButton; 38 | //清除录音 39 | @property (nonatomic,strong)UIButton * claerButton; 40 | @end 41 | 42 | @implementation ViewController 43 | 44 | - (void)viewDidLoad { 45 | [super viewDidLoad]; 46 | 47 | self.view.backgroundColor = [UIColor lightGrayColor]; 48 | 49 | self.recordTool = [LVRecordTool sharedRecordTool]; 50 | self.recordTool.delegate = self; 51 | 52 | ZZJRecordButton * recordButton = [ZZJRecordButton buttonWithType:UIButtonTypeCustom]; 53 | recordButton.frame = CGRectMake(0, ZZJScreenH - 49, ZZJScreenW, 49); 54 | recordButton.backgroundColor = [UIColor redColor]; 55 | recordButton.titleLabel.font = [UIFont systemFontOfSize:18]; 56 | [recordButton setTitle:@"按住 说话" forState:UIControlStateNormal]; 57 | 58 | [recordButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 59 | [self.view addSubview:recordButton]; 60 | self.recordButton = recordButton; 61 | //录音相关 62 | [self toDoRecord]; 63 | } 64 | 65 | #pragma mark ---- 录音全部状态的监听 以及视图的构建 切换 66 | -(void)toDoRecord 67 | { 68 | __weak typeof(self) weak_self = self; 69 | //手指按下 70 | self.recordButton.recordTouchDownAction = ^(ZZJRecordButton *sender){ 71 | 72 | //如果用户没有开启麦克风权限,不能让其录音 73 | if (![self canRecord]) return ; 74 | 75 | NSLog(@"开始录音"); 76 | if (sender.highlighted) { 77 | sender.highlighted = YES; 78 | [sender setButtonStateWithRecording]; 79 | } 80 | [weak_self.recordTool startRecording]; 81 | 82 | [weak_self removeView]; 83 | [weak_self voiceStateWithImage:@"shuohua" labelText:@"手指上滑 取消发送" isAnimation:YES]; 84 | 85 | }; 86 | 87 | //手指抬起 88 | self.recordButton.recordTouchUpInsideAction = ^(ZZJRecordButton *sender){ 89 | NSLog(@"完成录音"); 90 | [sender setButtonStateWithNormal]; 91 | [self.voiceButton removeFromSuperview]; 92 | [self.claerButton removeFromSuperview]; 93 | weak_self.currentRecordTime = weak_self.recordTool.recorder.currentTime; 94 | [self setupPlayButton]; 95 | 96 | [weak_self.recordTool stopRecording]; 97 | [weak_self removeView]; 98 | 99 | }; 100 | 101 | //手指滑出按钮 102 | self.recordButton.recordTouchUpOutsideAction = ^(ZZJRecordButton *sender){ 103 | NSLog(@"取消录音"); 104 | 105 | [sender setButtonStateWithNormal]; 106 | [weak_self removeView]; 107 | }; 108 | 109 | 110 | //中间状态 从 TouchDragInside ---> TouchDragOutside 111 | self.recordButton.recordTouchDragExitAction = ^(ZZJRecordButton *sender){ 112 | 113 | [weak_self removeView]; 114 | [weak_self voiceStateWithImage:@"quxiao" labelText:@"松开手指 取消发送" isAnimation:NO]; 115 | }; 116 | //中间状态 从 TouchDragOutside ---> TouchDragInside 117 | self.recordButton.recordTouchDragEnterAction = ^(ZZJRecordButton *sender){ 118 | NSLog(@"继续录音"); 119 | 120 | [weak_self removeView]; 121 | [weak_self voiceStateWithImage:@"shuohua" labelText:@"手指上滑 取消发送" isAnimation:YES]; 122 | }; 123 | } 124 | 125 | #pragma mark ---- 录音完成后,创建播放的按钮 126 | -(void)setupPlayButton 127 | { 128 | self.voiceButton = [UIButton buttonWithType:UIButtonTypeCustom]; 129 | [self.voiceButton setImage:[UIImage imageNamed:@"yuyin4"] forState:(UIControlStateNormal)]; 130 | //播放完成时,按钮会一直持续高亮状态,按钮图片的颜色会被系统默认渲染,写了这句按钮的显示就会正常 131 | [self.voiceButton setImage:[UIImage imageNamed:@"yuyin4"] forState:UIControlStateHighlighted]; 132 | [self.voiceButton setTitle:[NSString stringWithFormat:@" %.2lf ''",self.currentRecordTime] forState:(UIControlStateNormal)]; 133 | [self.voiceButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 134 | self.voiceButton.frame = CGRectMake(100, 200, 65, 25); 135 | // [self.voiceButton setImageEdgeInsets:UIEdgeInsetsMake(2, 0, 2, 20)]; 136 | self.voiceButton.titleLabel.font = [UIFont systemFontOfSize:13]; 137 | [self.voiceButton addTarget:self action:@selector(voiceButtonPlay) forControlEvents:(UIControlEventTouchUpInside)]; 138 | [self.view addSubview:self.voiceButton]; 139 | 140 | self.claerButton = [UIButton buttonWithType:UIButtonTypeCustom]; 141 | [self.claerButton setImage:[UIImage imageNamed:@"delete"] forState:(UIControlStateNormal)]; 142 | self.claerButton.frame = CGRectMake(166, 200, 15, 15); 143 | [self.claerButton addTarget:self action:@selector(claerButtonClick) forControlEvents:(UIControlEventTouchUpInside)]; 144 | [self.view addSubview:self.claerButton]; 145 | } 146 | 147 | 148 | #pragma mark ---- 发布语音的状态来创建提示视图 149 | -(void)voiceStateWithImage:(NSString *)imageName labelText:(NSString *)text isAnimation:(BOOL)Animation 150 | { 151 | UIImageView * bgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"voice_bg"]]; 152 | bgView.center = [UIApplication sharedApplication].keyWindow.center; 153 | [[UIApplication sharedApplication].keyWindow addSubview:bgView]; 154 | self.bgView = bgView; 155 | 156 | 157 | UIImageView * stateImageView; 158 | if (!Animation) { 159 | stateImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imageName]]; 160 | }else{ 161 | stateImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:imageName]]; 162 | stateImageView.animationImages = @[[UIImage imageNamed:imageName], 163 | [UIImage imageNamed:@"donghua_one"], 164 | [UIImage imageNamed:@"donghua_two"], 165 | ]; 166 | stateImageView.animationDuration = 0.6; 167 | [stateImageView startAnimating]; 168 | } 169 | stateImageView.y = 50; 170 | stateImageView.x = 80; 171 | stateImageView.contentMode = UIViewContentModeCenter; 172 | [self.bgView addSubview:stateImageView]; 173 | self.stateImageView = stateImageView; 174 | 175 | 176 | UILabel * textLabel = [[UILabel alloc] init]; 177 | textLabel.textColor = [UIColor whiteColor]; 178 | textLabel.textAlignment = NSTextAlignmentCenter; 179 | textLabel.font = [UIFont systemFontOfSize:15]; 180 | textLabel.text = text; 181 | textLabel.y = CGRectGetMaxY(self.stateImageView.frame) + 25; 182 | textLabel.x = 0; 183 | textLabel.width = self.bgView.width; 184 | textLabel.height = 20; 185 | [self.bgView addSubview:textLabel]; 186 | self.textLabel = textLabel; 187 | } 188 | 189 | #pragma mark ---- 销毁录音提示的视图 190 | -(void)removeView 191 | { 192 | [self.bgView removeFromSuperview]; 193 | [self.stateImageView removeFromSuperview]; 194 | [self.textLabel removeFromSuperview]; 195 | } 196 | 197 | 198 | #pragma mark --- 判断语音播放完毕 199 | -(void)recordToolDidFinishPlay:(LVRecordTool *)recordTool 200 | { 201 | 202 | self.voiceButton.imageView.image = nil; 203 | [self.voiceButton setImage:[UIImage imageNamed:@"yuyin4"] forState:UIControlStateHighlighted]; 204 | [self.voiceButton.imageView stopAnimating]; 205 | 206 | } 207 | #pragma mark --- 音量的回调 208 | -(void)recordTool:(LVRecordTool *)recordTool didstartRecoring:(int)no 209 | { 210 | //可在这里根据音量的大小进行相关操作 211 | } 212 | 213 | #pragma mark --- 播放录音 214 | - (void)voiceButtonPlay { 215 | [self.recordTool playRecordingFile]; 216 | 217 | self.voiceButton.imageView.animationImages = @[[UIImage imageNamed:@"yuyin4"], 218 | [UIImage imageNamed:@"yuyin1"], 219 | [UIImage imageNamed:@"yuyin2"], 220 | [UIImage imageNamed:@"yuyin3"] 221 | ]; 222 | self.voiceButton.imageView.animationDuration = 0.6; 223 | [self.voiceButton.imageView startAnimating]; 224 | } 225 | 226 | #pragma mark --- 删除录音 227 | - (void)claerButtonClick{ 228 | [self.recordTool destructionRecordingFile]; 229 | [self.voiceButton removeFromSuperview]; 230 | [self.claerButton removeFromSuperview]; 231 | } 232 | 233 | 234 | 235 | //判断是否允许使用麦克风7.0新增的方法requestRecordPermission 236 | -(BOOL)canRecord 237 | { 238 | __block BOOL bCanRecord = YES; 239 | AVAudioSession *audioSession = [AVAudioSession sharedInstance]; 240 | if ([audioSession respondsToSelector:@selector(requestRecordPermission:)]) { 241 | [audioSession performSelector:@selector(requestRecordPermission:) withObject:^(BOOL granted) { 242 | if (granted) { 243 | bCanRecord = YES; 244 | } 245 | else { 246 | bCanRecord = NO; 247 | dispatch_async(dispatch_get_main_queue(), ^{ 248 | [[[UIAlertView alloc] initWithTitle:nil 249 | message:@"app需要访问您的麦克风。\n请启用麦克风-设置/隐私/麦克风" 250 | delegate:nil 251 | cancelButtonTitle:@"关闭" 252 | otherButtonTitles:nil] show]; 253 | }); 254 | } 255 | }]; 256 | } 257 | return bCanRecord; 258 | } 259 | @end 260 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZZJRecord-Demo 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. 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 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-DemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-DemoTests/ZZJRecord_DemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZZJRecord_DemoTests.m 3 | // ZZJRecord-DemoTests 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZZJRecord_DemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZZJRecord_DemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-DemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ZZJRecord-Demo/ZZJRecord-DemoUITests/ZZJRecord_DemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZZJRecord_DemoUITests.m 3 | // ZZJRecord-DemoUITests 4 | // 5 | // Created by chefuzzj on 16/12/26. 6 | // Copyright © 2016年 chefuzzj. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZZJRecord_DemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZZJRecord_DemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------