├── LICENSE ├── README.md └── XTPasterManager ├── .DS_Store ├── XTPasterManager.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── teason23.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── tutu.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── teason23.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── tutu.xcuserdatad │ └── xcschemes │ ├── XTPasterManager.xcscheme │ └── xcschememanagement.plist ├── XTPasterManager ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── 1.imageset │ │ ├── 1.png │ │ └── Contents.json │ ├── 2.imageset │ │ ├── 2.png │ │ └── Contents.json │ ├── 3.imageset │ │ ├── 3.png │ │ └── Contents.json │ ├── 4.imageset │ │ ├── 4.png │ │ └── Contents.json │ ├── 5.imageset │ │ ├── 5.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-76.png │ │ ├── Icon-76@2x.png │ │ ├── Icon-Small.png │ │ ├── Icon-Small@2x-1.png │ │ ├── Icon-Small@2x.png │ │ ├── Icon-Small@3x.png │ │ ├── Icon-Spotlight-40.png │ │ ├── Icon-Spotlight-40@2x-1.png │ │ ├── Icon-Spotlight-40@2x.png │ │ └── Icon-Spotlight-40@3x.png │ ├── Contents.json │ ├── bt_paster_delete.imageset │ │ ├── Contents.json │ │ ├── 删除.png │ │ ├── 删除@2x.png │ │ └── 删除@3x.png │ ├── bt_paster_transform.imageset │ │ ├── Contents.json │ │ ├── 大小.png │ │ ├── 大小@2x.png │ │ └── 大小@3x.png │ └── dogs.imageset │ │ ├── Contents.json │ │ └── dogs.jpeg ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── Paster │ ├── XTPasterStageView.h │ ├── XTPasterStageView.m │ ├── XTPasterView.h │ └── XTPasterView.m ├── PasterChooseView.h ├── PasterChooseView.m ├── PasterChooseView.xib ├── PasterController.h ├── PasterController.m ├── UIImage+AddFunction.h ├── UIImage+AddFunction.m ├── ViewController.h ├── ViewController.m └── main.m ├── XTPasterManagerTests ├── Info.plist └── XTPasterManagerTests.m └── XTPasterManagerUITests ├── Info.plist └── XTPasterManagerUITests.m /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 teason 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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XTPaster 2 | iOS Paster Function 3 | 4 | ###HOW TO USE IT ? (使用方式原文链接) http://www.jianshu.com/p/d873d348bbfb 5 | 6 | 7 | -------------------------------------------------------------------------------- /XTPasterManager/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/.DS_Store -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D76278BA1BD10BAC00C438FC /* UIImage+AddFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = D76278B91BD10BAC00C438FC /* UIImage+AddFunction.m */; }; 11 | D78186361BD1027E00102759 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D78186351BD1027E00102759 /* main.m */; }; 12 | D78186391BD1027E00102759 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D78186381BD1027E00102759 /* AppDelegate.m */; }; 13 | D781863C1BD1027E00102759 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D781863B1BD1027E00102759 /* ViewController.m */; }; 14 | D781863F1BD1027E00102759 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D781863D1BD1027E00102759 /* Main.storyboard */; }; 15 | D78186411BD1027E00102759 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D78186401BD1027E00102759 /* Assets.xcassets */; }; 16 | D78186441BD1027E00102759 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D78186421BD1027E00102759 /* LaunchScreen.storyboard */; }; 17 | D781864F1BD1027E00102759 /* XTPasterManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D781864E1BD1027E00102759 /* XTPasterManagerTests.m */; }; 18 | D781865A1BD1027E00102759 /* XTPasterManagerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D78186591BD1027E00102759 /* XTPasterManagerUITests.m */; }; 19 | D78186691BD1035B00102759 /* PasterController.m in Sources */ = {isa = PBXBuildFile; fileRef = D78186681BD1035B00102759 /* PasterController.m */; }; 20 | D781866F1BD103F300102759 /* XTPasterStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D781866C1BD103F300102759 /* XTPasterStageView.m */; }; 21 | D78186701BD103F300102759 /* XTPasterView.m in Sources */ = {isa = PBXBuildFile; fileRef = D781866E1BD103F300102759 /* XTPasterView.m */; }; 22 | D78186741BD1043200102759 /* PasterChooseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D78186721BD1043200102759 /* PasterChooseView.m */; }; 23 | D78186751BD1043200102759 /* PasterChooseView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D78186731BD1043200102759 /* PasterChooseView.xib */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | D781864B1BD1027E00102759 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = D78186291BD1027E00102759 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = D78186301BD1027E00102759; 32 | remoteInfo = XTPasterManager; 33 | }; 34 | D78186561BD1027E00102759 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = D78186291BD1027E00102759 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = D78186301BD1027E00102759; 39 | remoteInfo = XTPasterManager; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | D76278B81BD10BAC00C438FC /* UIImage+AddFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+AddFunction.h"; sourceTree = ""; }; 45 | D76278B91BD10BAC00C438FC /* UIImage+AddFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+AddFunction.m"; sourceTree = ""; }; 46 | D78186311BD1027E00102759 /* XTPasterManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XTPasterManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | D78186351BD1027E00102759 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | D78186371BD1027E00102759 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | D78186381BD1027E00102759 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | D781863A1BD1027E00102759 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 51 | D781863B1BD1027E00102759 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 52 | D781863E1BD1027E00102759 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | D78186401BD1027E00102759 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | D78186431BD1027E00102759 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | D78186451BD1027E00102759 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | D781864A1BD1027E00102759 /* XTPasterManagerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XTPasterManagerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | D781864E1BD1027E00102759 /* XTPasterManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XTPasterManagerTests.m; sourceTree = ""; }; 58 | D78186501BD1027E00102759 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | D78186551BD1027E00102759 /* XTPasterManagerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XTPasterManagerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | D78186591BD1027E00102759 /* XTPasterManagerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XTPasterManagerUITests.m; sourceTree = ""; }; 61 | D781865B1BD1027E00102759 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | D78186671BD1035B00102759 /* PasterController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasterController.h; sourceTree = ""; }; 63 | D78186681BD1035B00102759 /* PasterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PasterController.m; sourceTree = ""; }; 64 | D781866B1BD103F300102759 /* XTPasterStageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XTPasterStageView.h; sourceTree = ""; }; 65 | D781866C1BD103F300102759 /* XTPasterStageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XTPasterStageView.m; sourceTree = ""; }; 66 | D781866D1BD103F300102759 /* XTPasterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XTPasterView.h; sourceTree = ""; }; 67 | D781866E1BD103F300102759 /* XTPasterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XTPasterView.m; sourceTree = ""; }; 68 | D78186711BD1043200102759 /* PasterChooseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasterChooseView.h; sourceTree = ""; }; 69 | D78186721BD1043200102759 /* PasterChooseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PasterChooseView.m; sourceTree = ""; }; 70 | D78186731BD1043200102759 /* PasterChooseView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasterChooseView.xib; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | D781862E1BD1027E00102759 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | D78186471BD1027E00102759 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | D78186521BD1027E00102759 /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | /* End PBXFrameworksBuildPhase section */ 96 | 97 | /* Begin PBXGroup section */ 98 | D76278BB1BD10DB200C438FC /* Util */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | D76278B81BD10BAC00C438FC /* UIImage+AddFunction.h */, 102 | D76278B91BD10BAC00C438FC /* UIImage+AddFunction.m */, 103 | ); 104 | name = Util; 105 | sourceTree = ""; 106 | }; 107 | D78186281BD1027E00102759 = { 108 | isa = PBXGroup; 109 | children = ( 110 | D78186331BD1027E00102759 /* XTPasterManager */, 111 | D781864D1BD1027E00102759 /* XTPasterManagerTests */, 112 | D78186581BD1027E00102759 /* XTPasterManagerUITests */, 113 | D78186321BD1027E00102759 /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | D78186321BD1027E00102759 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | D78186311BD1027E00102759 /* XTPasterManager.app */, 121 | D781864A1BD1027E00102759 /* XTPasterManagerTests.xctest */, 122 | D78186551BD1027E00102759 /* XTPasterManagerUITests.xctest */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | D78186331BD1027E00102759 /* XTPasterManager */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | D78186371BD1027E00102759 /* AppDelegate.h */, 131 | D78186381BD1027E00102759 /* AppDelegate.m */, 132 | D781863A1BD1027E00102759 /* ViewController.h */, 133 | D781863B1BD1027E00102759 /* ViewController.m */, 134 | D78186671BD1035B00102759 /* PasterController.h */, 135 | D78186681BD1035B00102759 /* PasterController.m */, 136 | D78186711BD1043200102759 /* PasterChooseView.h */, 137 | D78186721BD1043200102759 /* PasterChooseView.m */, 138 | D78186731BD1043200102759 /* PasterChooseView.xib */, 139 | D76278BB1BD10DB200C438FC /* Util */, 140 | D781866A1BD103F300102759 /* Paster */, 141 | D781863D1BD1027E00102759 /* Main.storyboard */, 142 | D78186401BD1027E00102759 /* Assets.xcassets */, 143 | D78186421BD1027E00102759 /* LaunchScreen.storyboard */, 144 | D78186451BD1027E00102759 /* Info.plist */, 145 | D78186341BD1027E00102759 /* Supporting Files */, 146 | ); 147 | path = XTPasterManager; 148 | sourceTree = ""; 149 | }; 150 | D78186341BD1027E00102759 /* Supporting Files */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | D78186351BD1027E00102759 /* main.m */, 154 | ); 155 | name = "Supporting Files"; 156 | sourceTree = ""; 157 | }; 158 | D781864D1BD1027E00102759 /* XTPasterManagerTests */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | D781864E1BD1027E00102759 /* XTPasterManagerTests.m */, 162 | D78186501BD1027E00102759 /* Info.plist */, 163 | ); 164 | path = XTPasterManagerTests; 165 | sourceTree = ""; 166 | }; 167 | D78186581BD1027E00102759 /* XTPasterManagerUITests */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | D78186591BD1027E00102759 /* XTPasterManagerUITests.m */, 171 | D781865B1BD1027E00102759 /* Info.plist */, 172 | ); 173 | path = XTPasterManagerUITests; 174 | sourceTree = ""; 175 | }; 176 | D781866A1BD103F300102759 /* Paster */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | D781866B1BD103F300102759 /* XTPasterStageView.h */, 180 | D781866C1BD103F300102759 /* XTPasterStageView.m */, 181 | D781866D1BD103F300102759 /* XTPasterView.h */, 182 | D781866E1BD103F300102759 /* XTPasterView.m */, 183 | ); 184 | path = Paster; 185 | sourceTree = ""; 186 | }; 187 | /* End PBXGroup section */ 188 | 189 | /* Begin PBXNativeTarget section */ 190 | D78186301BD1027E00102759 /* XTPasterManager */ = { 191 | isa = PBXNativeTarget; 192 | buildConfigurationList = D781865E1BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManager" */; 193 | buildPhases = ( 194 | D781862D1BD1027E00102759 /* Sources */, 195 | D781862E1BD1027E00102759 /* Frameworks */, 196 | D781862F1BD1027E00102759 /* Resources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | ); 202 | name = XTPasterManager; 203 | productName = XTPasterManager; 204 | productReference = D78186311BD1027E00102759 /* XTPasterManager.app */; 205 | productType = "com.apple.product-type.application"; 206 | }; 207 | D78186491BD1027E00102759 /* XTPasterManagerTests */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = D78186611BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManagerTests" */; 210 | buildPhases = ( 211 | D78186461BD1027E00102759 /* Sources */, 212 | D78186471BD1027E00102759 /* Frameworks */, 213 | D78186481BD1027E00102759 /* Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | D781864C1BD1027E00102759 /* PBXTargetDependency */, 219 | ); 220 | name = XTPasterManagerTests; 221 | productName = XTPasterManagerTests; 222 | productReference = D781864A1BD1027E00102759 /* XTPasterManagerTests.xctest */; 223 | productType = "com.apple.product-type.bundle.unit-test"; 224 | }; 225 | D78186541BD1027E00102759 /* XTPasterManagerUITests */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = D78186641BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManagerUITests" */; 228 | buildPhases = ( 229 | D78186511BD1027E00102759 /* Sources */, 230 | D78186521BD1027E00102759 /* Frameworks */, 231 | D78186531BD1027E00102759 /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | D78186571BD1027E00102759 /* PBXTargetDependency */, 237 | ); 238 | name = XTPasterManagerUITests; 239 | productName = XTPasterManagerUITests; 240 | productReference = D78186551BD1027E00102759 /* XTPasterManagerUITests.xctest */; 241 | productType = "com.apple.product-type.bundle.ui-testing"; 242 | }; 243 | /* End PBXNativeTarget section */ 244 | 245 | /* Begin PBXProject section */ 246 | D78186291BD1027E00102759 /* Project object */ = { 247 | isa = PBXProject; 248 | attributes = { 249 | LastUpgradeCheck = 0700; 250 | ORGANIZATIONNAME = teason; 251 | TargetAttributes = { 252 | D78186301BD1027E00102759 = { 253 | CreatedOnToolsVersion = 7.0; 254 | DevelopmentTeam = 5D74XHX7AD; 255 | }; 256 | D78186491BD1027E00102759 = { 257 | CreatedOnToolsVersion = 7.0; 258 | TestTargetID = D78186301BD1027E00102759; 259 | }; 260 | D78186541BD1027E00102759 = { 261 | CreatedOnToolsVersion = 7.0; 262 | TestTargetID = D78186301BD1027E00102759; 263 | }; 264 | }; 265 | }; 266 | buildConfigurationList = D781862C1BD1027E00102759 /* Build configuration list for PBXProject "XTPasterManager" */; 267 | compatibilityVersion = "Xcode 3.2"; 268 | developmentRegion = English; 269 | hasScannedForEncodings = 0; 270 | knownRegions = ( 271 | en, 272 | Base, 273 | ); 274 | mainGroup = D78186281BD1027E00102759; 275 | productRefGroup = D78186321BD1027E00102759 /* Products */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | D78186301BD1027E00102759 /* XTPasterManager */, 280 | D78186491BD1027E00102759 /* XTPasterManagerTests */, 281 | D78186541BD1027E00102759 /* XTPasterManagerUITests */, 282 | ); 283 | }; 284 | /* End PBXProject section */ 285 | 286 | /* Begin PBXResourcesBuildPhase section */ 287 | D781862F1BD1027E00102759 /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | D78186751BD1043200102759 /* PasterChooseView.xib in Resources */, 292 | D78186441BD1027E00102759 /* LaunchScreen.storyboard in Resources */, 293 | D78186411BD1027E00102759 /* Assets.xcassets in Resources */, 294 | D781863F1BD1027E00102759 /* Main.storyboard in Resources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | D78186481BD1027E00102759 /* Resources */ = { 299 | isa = PBXResourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | D78186531BD1027E00102759 /* Resources */ = { 306 | isa = PBXResourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | ); 310 | runOnlyForDeploymentPostprocessing = 0; 311 | }; 312 | /* End PBXResourcesBuildPhase section */ 313 | 314 | /* Begin PBXSourcesBuildPhase section */ 315 | D781862D1BD1027E00102759 /* Sources */ = { 316 | isa = PBXSourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | D78186691BD1035B00102759 /* PasterController.m in Sources */, 320 | D781863C1BD1027E00102759 /* ViewController.m in Sources */, 321 | D78186391BD1027E00102759 /* AppDelegate.m in Sources */, 322 | D76278BA1BD10BAC00C438FC /* UIImage+AddFunction.m in Sources */, 323 | D78186701BD103F300102759 /* XTPasterView.m in Sources */, 324 | D78186361BD1027E00102759 /* main.m in Sources */, 325 | D781866F1BD103F300102759 /* XTPasterStageView.m in Sources */, 326 | D78186741BD1043200102759 /* PasterChooseView.m in Sources */, 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | }; 330 | D78186461BD1027E00102759 /* Sources */ = { 331 | isa = PBXSourcesBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | D781864F1BD1027E00102759 /* XTPasterManagerTests.m in Sources */, 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | D78186511BD1027E00102759 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | D781865A1BD1027E00102759 /* XTPasterManagerUITests.m in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | /* End PBXSourcesBuildPhase section */ 347 | 348 | /* Begin PBXTargetDependency section */ 349 | D781864C1BD1027E00102759 /* PBXTargetDependency */ = { 350 | isa = PBXTargetDependency; 351 | target = D78186301BD1027E00102759 /* XTPasterManager */; 352 | targetProxy = D781864B1BD1027E00102759 /* PBXContainerItemProxy */; 353 | }; 354 | D78186571BD1027E00102759 /* PBXTargetDependency */ = { 355 | isa = PBXTargetDependency; 356 | target = D78186301BD1027E00102759 /* XTPasterManager */; 357 | targetProxy = D78186561BD1027E00102759 /* PBXContainerItemProxy */; 358 | }; 359 | /* End PBXTargetDependency section */ 360 | 361 | /* Begin PBXVariantGroup section */ 362 | D781863D1BD1027E00102759 /* Main.storyboard */ = { 363 | isa = PBXVariantGroup; 364 | children = ( 365 | D781863E1BD1027E00102759 /* Base */, 366 | ); 367 | name = Main.storyboard; 368 | sourceTree = ""; 369 | }; 370 | D78186421BD1027E00102759 /* LaunchScreen.storyboard */ = { 371 | isa = PBXVariantGroup; 372 | children = ( 373 | D78186431BD1027E00102759 /* Base */, 374 | ); 375 | name = LaunchScreen.storyboard; 376 | sourceTree = ""; 377 | }; 378 | /* End PBXVariantGroup section */ 379 | 380 | /* Begin XCBuildConfiguration section */ 381 | D781865C1BD1027E00102759 /* Debug */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ALWAYS_SEARCH_USER_PATHS = NO; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | D781865D1BD1027E00102759 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 430 | CLANG_CXX_LIBRARY = "libc++"; 431 | CLANG_ENABLE_MODULES = YES; 432 | CLANG_ENABLE_OBJC_ARC = YES; 433 | CLANG_WARN_BOOL_CONVERSION = YES; 434 | CLANG_WARN_CONSTANT_CONVERSION = YES; 435 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 436 | CLANG_WARN_EMPTY_BODY = YES; 437 | CLANG_WARN_ENUM_CONVERSION = YES; 438 | CLANG_WARN_INT_CONVERSION = YES; 439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 443 | COPY_PHASE_STRIP = NO; 444 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 445 | ENABLE_NS_ASSERTIONS = NO; 446 | ENABLE_STRICT_OBJC_MSGSEND = YES; 447 | GCC_C_LANGUAGE_STANDARD = gnu99; 448 | GCC_NO_COMMON_BLOCKS = YES; 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 456 | MTL_ENABLE_DEBUG_INFO = NO; 457 | SDKROOT = iphoneos; 458 | TARGETED_DEVICE_FAMILY = "1,2"; 459 | VALIDATE_PRODUCT = YES; 460 | }; 461 | name = Release; 462 | }; 463 | D781865F1BD1027E00102759 /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 467 | DEVELOPMENT_TEAM = 5D74XHX7AD; 468 | INFOPLIST_FILE = XTPasterManager/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | PRODUCT_BUNDLE_IDENTIFIER = com.teason.XTPasterManager; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | }; 473 | name = Debug; 474 | }; 475 | D78186601BD1027E00102759 /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 479 | DEVELOPMENT_TEAM = 5D74XHX7AD; 480 | INFOPLIST_FILE = XTPasterManager/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 482 | PRODUCT_BUNDLE_IDENTIFIER = com.teason.XTPasterManager; 483 | PRODUCT_NAME = "$(TARGET_NAME)"; 484 | }; 485 | name = Release; 486 | }; 487 | D78186621BD1027E00102759 /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | BUNDLE_LOADER = "$(TEST_HOST)"; 491 | INFOPLIST_FILE = XTPasterManagerTests/Info.plist; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = zzz.XTPasterManagerTests; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XTPasterManager.app/XTPasterManager"; 496 | }; 497 | name = Debug; 498 | }; 499 | D78186631BD1027E00102759 /* Release */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | BUNDLE_LOADER = "$(TEST_HOST)"; 503 | INFOPLIST_FILE = XTPasterManagerTests/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = zzz.XTPasterManagerTests; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XTPasterManager.app/XTPasterManager"; 508 | }; 509 | name = Release; 510 | }; 511 | D78186651BD1027E00102759 /* Debug */ = { 512 | isa = XCBuildConfiguration; 513 | buildSettings = { 514 | INFOPLIST_FILE = XTPasterManagerUITests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = zzz.XTPasterManagerUITests; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | TEST_TARGET_NAME = XTPasterManager; 519 | USES_XCTRUNNER = YES; 520 | }; 521 | name = Debug; 522 | }; 523 | D78186661BD1027E00102759 /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | INFOPLIST_FILE = XTPasterManagerUITests/Info.plist; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | PRODUCT_BUNDLE_IDENTIFIER = zzz.XTPasterManagerUITests; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | TEST_TARGET_NAME = XTPasterManager; 531 | USES_XCTRUNNER = YES; 532 | }; 533 | name = Release; 534 | }; 535 | /* End XCBuildConfiguration section */ 536 | 537 | /* Begin XCConfigurationList section */ 538 | D781862C1BD1027E00102759 /* Build configuration list for PBXProject "XTPasterManager" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | D781865C1BD1027E00102759 /* Debug */, 542 | D781865D1BD1027E00102759 /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | defaultConfigurationName = Release; 546 | }; 547 | D781865E1BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManager" */ = { 548 | isa = XCConfigurationList; 549 | buildConfigurations = ( 550 | D781865F1BD1027E00102759 /* Debug */, 551 | D78186601BD1027E00102759 /* Release */, 552 | ); 553 | defaultConfigurationIsVisible = 0; 554 | defaultConfigurationName = Release; 555 | }; 556 | D78186611BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManagerTests" */ = { 557 | isa = XCConfigurationList; 558 | buildConfigurations = ( 559 | D78186621BD1027E00102759 /* Debug */, 560 | D78186631BD1027E00102759 /* Release */, 561 | ); 562 | defaultConfigurationIsVisible = 0; 563 | defaultConfigurationName = Release; 564 | }; 565 | D78186641BD1027E00102759 /* Build configuration list for PBXNativeTarget "XTPasterManagerUITests" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | D78186651BD1027E00102759 /* Debug */, 569 | D78186661BD1027E00102759 /* Release */, 570 | ); 571 | defaultConfigurationIsVisible = 0; 572 | defaultConfigurationName = Release; 573 | }; 574 | /* End XCConfigurationList section */ 575 | }; 576 | rootObject = D78186291BD1027E00102759 /* Project object */; 577 | } 578 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/xcuserdata/teason23.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/xcuserdata/teason23.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/xcuserdata/tutu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager.xcodeproj/project.xcworkspace/xcuserdata/tutu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/xcuserdata/teason23.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XTPasterManager.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/xcuserdata/tutu.xcuserdatad/xcschemes/XTPasterManager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager.xcodeproj/xcuserdata/tutu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XTPasterManager.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D78186301BD1027E00102759 16 | 17 | primary 18 | 19 | 20 | D78186491BD1027E00102759 21 | 22 | primary 23 | 24 | 25 | D78186541BD1027E00102759 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. 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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. 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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/1.imageset/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/1.imageset/1.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/2.imageset/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/2.imageset/2.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/3.imageset/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/3.imageset/3.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/4.imageset/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/4.imageset/4.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/5.imageset/5.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-Small@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-Small@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-Spotlight-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-Spotlight-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "29x29", 41 | "idiom" : "ipad", 42 | "filename" : "Icon-Small.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "Icon-Small@2x-1.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "40x40", 53 | "idiom" : "ipad", 54 | "filename" : "Icon-Spotlight-40.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-Spotlight-40@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "76x76", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-76.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "76x76", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-76@2x.png", 73 | "scale" : "2x" 74 | } 75 | ], 76 | "info" : { 77 | "version" : 1, 78 | "author" : "xcode" 79 | } 80 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x-1.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/AppIcon.appiconset/Icon-Spotlight-40@3x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "删除.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "删除@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "删除@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_delete.imageset/删除@3x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "大小.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "大小@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "大小@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小@2x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/bt_paster_transform.imageset/大小@3x.png -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/dogs.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "dogs.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Assets.xcassets/dogs.imageset/dogs.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akateason/XTPaster/eb2ba8a64f13e22be3ad8fdbe3dba6542875ee6a/XTPasterManager/XTPasterManager/Assets.xcassets/dogs.imageset/dogs.jpeg -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/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 | 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 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 89 | 103 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Paster/XTPasterStageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterStageView.h 3 | // XTPasterManager 4 | // 5 | // Created by apple on 15/7/8. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XTPasterStageView : UIView 12 | 13 | @property (nonatomic,strong) UIImage *originImage ; 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame ; 16 | - (void)addPasterWithImg:(UIImage *)imgP ; 17 | - (UIImage *)doneEdit ; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Paster/XTPasterStageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterStageView.m 3 | // XTPasterManager 4 | // 5 | // Created by apple on 15/7/8. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import "XTPasterStageView.h" 10 | #import "XTPasterView.h" 11 | #import "UIImage+AddFunction.h" 12 | 13 | #define APPFRAME [UIScreen mainScreen].bounds 14 | 15 | @interface XTPasterStageView () 16 | { 17 | CGPoint startPoint ; 18 | CGPoint touchPoint ; 19 | NSMutableArray *m_listPaster ; 20 | } 21 | 22 | @property (nonatomic,strong) UIButton *bgButton ; 23 | @property (nonatomic,strong) UIImageView *imgView ; 24 | @property (nonatomic,strong) XTPasterView *pasterCurrent ; 25 | @property (nonatomic) int newPasterID ; 26 | 27 | @end 28 | 29 | @implementation XTPasterStageView 30 | 31 | - (void)setOriginImage:(UIImage *)originImage 32 | { 33 | _originImage = originImage ; 34 | 35 | self.imgView.image = originImage ; 36 | } 37 | 38 | - (int)newPasterID 39 | { 40 | _newPasterID++ ; 41 | 42 | return _newPasterID ; 43 | } 44 | 45 | - (void)setPasterCurrent:(XTPasterView *)pasterCurrent 46 | { 47 | _pasterCurrent = pasterCurrent ; 48 | 49 | [self bringSubviewToFront:_pasterCurrent] ; 50 | } 51 | 52 | - (UIButton *)bgButton 53 | { 54 | if (!_bgButton) { 55 | _bgButton = [[UIButton alloc] initWithFrame:self.frame] ; 56 | _bgButton.tintColor = nil ; 57 | _bgButton.backgroundColor = nil ; 58 | [_bgButton addTarget:self 59 | action:@selector(backgroundClicked:) 60 | forControlEvents:UIControlEventTouchUpInside] ; 61 | if (![_bgButton superview]) { 62 | [self addSubview:_bgButton] ; 63 | } 64 | } 65 | 66 | return _bgButton ; 67 | } 68 | 69 | - (UIImageView *)imgView 70 | { 71 | if (!_imgView) 72 | { 73 | CGRect rect = CGRectZero ; 74 | rect.size.width = self.frame.size.width ; 75 | rect.size.height = self.frame.size.width ; 76 | rect.origin.y = ( self.frame.size.height - self.frame.size.width ) / 2.0 ; 77 | _imgView = [[UIImageView alloc] initWithFrame:rect] ; 78 | 79 | _imgView.contentMode = UIViewContentModeScaleAspectFit ; 80 | 81 | if (![_imgView superview]) 82 | { 83 | [self addSubview:_imgView] ; 84 | } 85 | } 86 | 87 | return _imgView ; 88 | } 89 | 90 | #pragma mark - initial 91 | - (instancetype)initWithFrame:(CGRect)frame 92 | { 93 | self = [super initWithFrame:frame]; 94 | if (self) 95 | { 96 | m_listPaster = [[NSMutableArray alloc] initWithCapacity:1] ; 97 | [self imgView] ; 98 | [self bgButton] ; 99 | } 100 | 101 | return self; 102 | } 103 | 104 | #pragma mark - public 105 | - (void)addPasterWithImg:(UIImage *)imgP 106 | { 107 | [self clearAllOnFirst] ; 108 | self.pasterCurrent = [[XTPasterView alloc] initWithBgView:self 109 | pasterID:self.newPasterID 110 | img:imgP] ; 111 | _pasterCurrent.delegate = self ; 112 | [m_listPaster addObject:_pasterCurrent] ; 113 | } 114 | 115 | - (UIImage *)doneEdit 116 | { 117 | // NSLog(@"done") ; 118 | [self clearAllOnFirst] ; 119 | 120 | // NSLog(@"self.originImage.size : %@",NSStringFromCGSize(self.originImage.size)) ; 121 | CGFloat org_width = self.originImage.size.width ; 122 | CGFloat org_heigh = self.originImage.size.height ; 123 | CGFloat rateOfScreen = org_width / org_heigh ; 124 | CGFloat inScreenH = self.frame.size.width / rateOfScreen ; 125 | 126 | CGRect rect = CGRectZero ; 127 | rect.size = CGSizeMake(APPFRAME.size.width, inScreenH) ; 128 | rect.origin = CGPointMake(0, (self.frame.size.height - inScreenH) / 2) ; 129 | 130 | UIImage *imgTemp = [UIImage getImageFromView:self] ; 131 | // NSLog(@"imgTemp.size : %@",NSStringFromCGSize(imgTemp.size)) ; 132 | 133 | UIImage *imgCut = [UIImage squareImageFromImage:imgTemp scaledToSize:rect.size.width] ; 134 | 135 | return imgCut ; 136 | } 137 | 138 | 139 | - (void)backgroundClicked:(UIButton *)btBg 140 | { 141 | NSLog(@"back clicked") ; 142 | 143 | [self clearAllOnFirst] ; 144 | } 145 | 146 | - (void)clearAllOnFirst 147 | { 148 | _pasterCurrent.isOnFirst = NO ; 149 | 150 | [m_listPaster enumerateObjectsUsingBlock:^(XTPasterView *pasterV, NSUInteger idx, BOOL * _Nonnull stop) { 151 | pasterV.isOnFirst = NO ; 152 | }] ; 153 | } 154 | 155 | #pragma mark - PasterViewDelegate 156 | - (void)makePasterBecomeFirstRespond:(int)pasterID ; 157 | { 158 | [m_listPaster enumerateObjectsUsingBlock:^(XTPasterView *pasterV, NSUInteger idx, BOOL * _Nonnull stop) { 159 | 160 | pasterV.isOnFirst = NO ; 161 | 162 | if (pasterV.pasterID == pasterID) 163 | { 164 | self.pasterCurrent = pasterV ; 165 | pasterV.isOnFirst = YES ; 166 | } 167 | 168 | }] ; 169 | } 170 | 171 | - (void)removePaster:(int)pasterID 172 | { 173 | [m_listPaster enumerateObjectsUsingBlock:^(XTPasterView *pasterV, NSUInteger idx, BOOL * _Nonnull stop) { 174 | if (pasterV.pasterID == pasterID) 175 | { 176 | [m_listPaster removeObjectAtIndex:idx] ; 177 | *stop = YES ; 178 | } 179 | }] ; 180 | } 181 | 182 | @end 183 | 184 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Paster/XTPasterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterView.h 3 | // XTPasterManager 4 | // 5 | // Created by apple on 15/7/8. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XTPasterStageView.h" 11 | 12 | @class XTPasterView ; 13 | 14 | @protocol XTPasterViewDelegate 15 | - (void)makePasterBecomeFirstRespond:(int)pasterID ; 16 | - (void)removePaster:(int)pasterID ; 17 | @end 18 | 19 | @interface XTPasterView : UIView 20 | 21 | @property (nonatomic,strong) UIImage *imagePaster ; 22 | @property (nonatomic) int pasterID ; 23 | @property (nonatomic) BOOL isOnFirst ; 24 | @property (nonatomic,weak) id delegate ; 25 | - (instancetype)initWithBgView:(XTPasterStageView *)bgView 26 | pasterID:(int)pasterID 27 | img:(UIImage *)img ; 28 | - (void)remove ; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/Paster/XTPasterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterView.m 3 | // XTPasterManager 4 | // 5 | // Created by apple on 15/7/8. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import "XTPasterView.h" 10 | 11 | #define PASTER_SLIDE 150.0 12 | #define FLEX_SLIDE 15.0 13 | #define BT_SLIDE 30.0 14 | #define BORDER_LINE_WIDTH 1.0 15 | #define SECURITY_LENGTH 75.0 16 | 17 | 18 | @interface XTPasterView () 19 | { 20 | CGFloat minWidth; 21 | CGFloat minHeight; 22 | CGFloat deltaAngle; 23 | CGPoint prevPoint; 24 | CGPoint touchStart; 25 | CGRect bgRect ; 26 | } 27 | 28 | @property (nonatomic,strong) UIImageView *imgContentView ; 29 | @property (nonatomic,strong) UIImageView *btDelete ; 30 | @property (nonatomic,strong) UIImageView *btSizeCtrl ; 31 | 32 | @end 33 | 34 | @implementation XTPasterView 35 | 36 | - (void)remove 37 | { 38 | [self removeFromSuperview] ; 39 | [self.delegate removePaster:self.pasterID] ; 40 | } 41 | 42 | #pragma mark -- Initial 43 | - (instancetype)initWithBgView:(XTPasterStageView *)bgView 44 | pasterID:(int)pasterID 45 | img:(UIImage *)img 46 | { 47 | self = [super init]; 48 | if (self) 49 | { 50 | self.pasterID = pasterID ; 51 | self.imagePaster = img ; 52 | 53 | bgRect = bgView.frame ; 54 | 55 | [self setupWithBGFrame:bgRect] ; 56 | [self imgContentView] ; 57 | [self btDelete] ; 58 | [self btSizeCtrl] ; 59 | [bgView addSubview:self] ; 60 | self.isOnFirst = YES ; 61 | } 62 | return self; 63 | } 64 | 65 | 66 | - (void)setFrame:(CGRect)newFrame 67 | { 68 | [super setFrame:newFrame]; 69 | 70 | CGRect rect = CGRectZero ; 71 | CGFloat sliderContent = PASTER_SLIDE - FLEX_SLIDE * 2 ; 72 | rect.origin = CGPointMake(FLEX_SLIDE, FLEX_SLIDE) ; 73 | rect.size = CGSizeMake(sliderContent, sliderContent) ; 74 | self.imgContentView.frame = rect ; 75 | 76 | self.imgContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 77 | } 78 | 79 | 80 | - (void)resizeTranslate:(UIPanGestureRecognizer *)recognizer 81 | { 82 | if ([recognizer state] == UIGestureRecognizerStateBegan) 83 | { 84 | prevPoint = [recognizer locationInView:self]; 85 | [self setNeedsDisplay]; 86 | } 87 | else if ([recognizer state] == UIGestureRecognizerStateChanged) 88 | { 89 | // preventing from the picture being shrinked too far by resizing 90 | if (self.bounds.size.width < minWidth || self.bounds.size.height < minHeight) 91 | { 92 | self.bounds = CGRectMake(self.bounds.origin.x, 93 | self.bounds.origin.y, 94 | minWidth + 1 , 95 | minHeight + 1); 96 | self.btSizeCtrl.frame =CGRectMake(self.bounds.size.width-BT_SLIDE, 97 | self.bounds.size.height-BT_SLIDE, 98 | BT_SLIDE, 99 | BT_SLIDE); 100 | prevPoint = [recognizer locationInView:self]; 101 | } 102 | // Resizing 103 | else 104 | { 105 | CGPoint point = [recognizer locationInView:self]; 106 | float wChange = 0.0, hChange = 0.0; 107 | 108 | wChange = (point.x - prevPoint.x); 109 | float wRatioChange = (wChange/(float)self.bounds.size.width); 110 | 111 | hChange = wRatioChange * self.bounds.size.height; 112 | 113 | if (ABS(wChange) > 50.0f || ABS(hChange) > 50.0f) 114 | { 115 | prevPoint = [recognizer locationOfTouch:0 inView:self]; 116 | return; 117 | } 118 | 119 | CGFloat finalWidth = self.bounds.size.width + (wChange) ; 120 | CGFloat finalHeight = self.bounds.size.height + (wChange) ; 121 | 122 | if (finalWidth > PASTER_SLIDE*(1+0.5)) 123 | { 124 | finalWidth = PASTER_SLIDE*(1+0.5) ; 125 | } 126 | if (finalWidth < PASTER_SLIDE*(1-0.5)) 127 | { 128 | finalWidth = PASTER_SLIDE*(1-0.5) ; 129 | } 130 | if (finalHeight > PASTER_SLIDE*(1+0.5)) 131 | { 132 | finalHeight = PASTER_SLIDE*(1+0.5) ; 133 | } 134 | if (finalHeight < PASTER_SLIDE*(1-0.5)) 135 | { 136 | finalHeight = PASTER_SLIDE*(1-0.5) ; 137 | } 138 | 139 | self.bounds = CGRectMake(self.bounds.origin.x, 140 | self.bounds.origin.y, 141 | finalWidth, 142 | finalHeight) ; 143 | 144 | self.btSizeCtrl.frame = CGRectMake(self.bounds.size.width-BT_SLIDE , 145 | self.bounds.size.height-BT_SLIDE , 146 | BT_SLIDE , 147 | BT_SLIDE) ; 148 | 149 | prevPoint = [recognizer locationOfTouch:0 150 | inView:self] ; 151 | } 152 | 153 | /* Rotation */ 154 | float ang = atan2([recognizer locationInView:self.superview].y - self.center.y, 155 | [recognizer locationInView:self.superview].x - self.center.x) ; 156 | 157 | float angleDiff = deltaAngle - ang ; 158 | 159 | self.transform = CGAffineTransformMakeRotation(-angleDiff) ; 160 | 161 | [self setNeedsDisplay] ; 162 | } 163 | else if ([recognizer state] == UIGestureRecognizerStateEnded) 164 | { 165 | prevPoint = [recognizer locationInView:self]; 166 | [self setNeedsDisplay]; 167 | } 168 | } 169 | 170 | - (void)setImagePaster:(UIImage *)imagePaster 171 | { 172 | _imagePaster = imagePaster ; 173 | 174 | self.imgContentView.image = imagePaster ; 175 | } 176 | 177 | 178 | - (void)setupWithBGFrame:(CGRect)bgFrame 179 | { 180 | CGRect rect = CGRectZero ; 181 | rect.size = CGSizeMake(PASTER_SLIDE, PASTER_SLIDE) ; 182 | self.frame = rect ; 183 | self.center = CGPointMake(bgFrame.size.width / 2, bgFrame.size.height / 2) ; 184 | self.backgroundColor = nil ; 185 | 186 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)] ; 187 | [self addGestureRecognizer:tapGesture] ; 188 | 189 | // UIPinchGestureRecognizer *pincheGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)] ; 190 | // [self addGestureRecognizer:pincheGesture] ; 191 | 192 | UIRotationGestureRecognizer *rotateGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotation:)] ; 193 | [self addGestureRecognizer:rotateGesture] ; 194 | 195 | self.userInteractionEnabled = YES ; 196 | 197 | minWidth = self.bounds.size.width * 0.5; 198 | minHeight = self.bounds.size.height * 0.5; 199 | 200 | deltaAngle = atan2(self.frame.origin.y+self.frame.size.height - self.center.y, 201 | self.frame.origin.x+self.frame.size.width - self.center.x) ; 202 | 203 | } 204 | 205 | - (void)tap:(UITapGestureRecognizer *)tapGesture 206 | { 207 | NSLog(@"tap paster become first respond") ; 208 | self.isOnFirst = YES ; 209 | [self.delegate makePasterBecomeFirstRespond:self.pasterID] ; 210 | } 211 | 212 | - (void)handlePinch:(UIPinchGestureRecognizer *)pinchGesture 213 | { 214 | self.isOnFirst = YES ; 215 | [self.delegate makePasterBecomeFirstRespond:self.pasterID] ; 216 | 217 | self.imgContentView.transform = CGAffineTransformScale(self.imgContentView.transform, 218 | pinchGesture.scale, 219 | pinchGesture.scale) ; 220 | pinchGesture.scale = 1 ; 221 | } 222 | 223 | - (void)handleRotation:(UIRotationGestureRecognizer *)rotateGesture 224 | { 225 | self.isOnFirst = YES ; 226 | [self.delegate makePasterBecomeFirstRespond:self.pasterID] ; 227 | 228 | self.transform = CGAffineTransformRotate(self.transform, rotateGesture.rotation) ; 229 | rotateGesture.rotation = 0 ; 230 | } 231 | 232 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 233 | { 234 | self.isOnFirst = YES ; 235 | [self.delegate makePasterBecomeFirstRespond:self.pasterID] ; 236 | 237 | UITouch *touch = [touches anyObject] ; 238 | touchStart = [touch locationInView:self.superview] ; 239 | } 240 | 241 | - (void)translateUsingTouchLocation:(CGPoint)touchPoint 242 | { 243 | CGPoint newCenter = CGPointMake(self.center.x + touchPoint.x - touchStart.x, 244 | self.center.y + touchPoint.y - touchStart.y) ; 245 | 246 | // Ensure the translation won't cause the view to move offscreen. BEGIN 247 | CGFloat midPointX = CGRectGetMidX(self.bounds) ; 248 | if (newCenter.x > self.superview.bounds.size.width - midPointX + SECURITY_LENGTH) 249 | { 250 | newCenter.x = self.superview.bounds.size.width - midPointX + SECURITY_LENGTH; 251 | } 252 | if (newCenter.x < midPointX - SECURITY_LENGTH) 253 | { 254 | newCenter.x = midPointX - SECURITY_LENGTH; 255 | } 256 | 257 | CGFloat midPointY = CGRectGetMidY(self.bounds); 258 | if (newCenter.y > self.superview.bounds.size.height - midPointY + SECURITY_LENGTH) 259 | { 260 | newCenter.y = self.superview.bounds.size.height - midPointY + SECURITY_LENGTH; 261 | } 262 | if (newCenter.y < midPointY - SECURITY_LENGTH) 263 | { 264 | newCenter.y = midPointY - SECURITY_LENGTH; 265 | } 266 | 267 | // Ensure the translation won't cause the view to move offscreen. END 268 | self.center = newCenter; 269 | } 270 | 271 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 272 | { 273 | CGPoint touchLocation = [[touches anyObject] locationInView:self]; 274 | if (CGRectContainsPoint(self.btSizeCtrl.frame, touchLocation)) { 275 | return; 276 | } 277 | 278 | CGPoint touch = [[touches anyObject] locationInView:self.superview]; 279 | 280 | [self translateUsingTouchLocation:touch] ; 281 | 282 | touchStart = touch; 283 | } 284 | 285 | #pragma mark -- Properties 286 | - (void)setIsOnFirst:(BOOL)isOnFirst 287 | { 288 | _isOnFirst = isOnFirst ; 289 | 290 | self.btDelete.hidden = !isOnFirst ; 291 | self.btSizeCtrl.hidden = !isOnFirst ; 292 | self.imgContentView.layer.borderWidth = isOnFirst ? BORDER_LINE_WIDTH : 0.0f ; 293 | 294 | if (isOnFirst) 295 | { 296 | NSLog(@"pasterID : %d is On",self.pasterID) ; 297 | } 298 | } 299 | 300 | - (UIImageView *)imgContentView 301 | { 302 | if (!_imgContentView) 303 | { 304 | CGRect rect = CGRectZero ; 305 | CGFloat sliderContent = PASTER_SLIDE - FLEX_SLIDE * 2 ; 306 | rect.origin = CGPointMake(FLEX_SLIDE, FLEX_SLIDE) ; 307 | rect.size = CGSizeMake(sliderContent, sliderContent) ; 308 | 309 | _imgContentView = [[UIImageView alloc] initWithFrame:rect] ; 310 | _imgContentView.backgroundColor = nil ; 311 | _imgContentView.layer.borderColor = [UIColor whiteColor].CGColor ; 312 | _imgContentView.layer.borderWidth = BORDER_LINE_WIDTH ; 313 | _imgContentView.contentMode = UIViewContentModeScaleAspectFit ; 314 | 315 | if (![_imgContentView superview]) 316 | { 317 | [self addSubview:_imgContentView] ; 318 | } 319 | } 320 | 321 | return _imgContentView ; 322 | } 323 | 324 | - (UIImageView *)btSizeCtrl 325 | { 326 | if (!_btSizeCtrl) 327 | { 328 | _btSizeCtrl = [[UIImageView alloc]initWithFrame:CGRectMake(self.frame.size.width - BT_SLIDE , 329 | self.frame.size.height - BT_SLIDE , 330 | BT_SLIDE , 331 | BT_SLIDE) 332 | ] ; 333 | _btSizeCtrl.userInteractionEnabled = YES; 334 | _btSizeCtrl.image = [UIImage imageNamed:@"bt_paster_transform"] ; 335 | 336 | UIPanGestureRecognizer *panResizeGesture = [[UIPanGestureRecognizer alloc] 337 | initWithTarget:self 338 | action:@selector(resizeTranslate:)] ; 339 | [_btSizeCtrl addGestureRecognizer:panResizeGesture] ; 340 | if (![_btSizeCtrl superview]) { 341 | [self addSubview:_btSizeCtrl] ; 342 | } 343 | } 344 | 345 | return _btSizeCtrl ; 346 | } 347 | 348 | - (UIImageView *)btDelete 349 | { 350 | if (!_btDelete) 351 | { 352 | CGRect btRect = CGRectZero ; 353 | btRect.size = CGSizeMake(BT_SLIDE, BT_SLIDE) ; 354 | 355 | _btDelete = [[UIImageView alloc]initWithFrame:btRect] ; 356 | _btDelete.userInteractionEnabled = YES; 357 | _btDelete.image = [UIImage imageNamed:@"bt_paster_delete"] ; 358 | 359 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] 360 | initWithTarget:self 361 | action:@selector(btDeletePressed:)] ; 362 | [_btDelete addGestureRecognizer:tap] ; 363 | 364 | if (![_btDelete superview]) { 365 | [self addSubview:_btDelete] ; 366 | } 367 | } 368 | 369 | return _btDelete ; 370 | } 371 | 372 | - (void)btDeletePressed:(id)btDel 373 | { 374 | NSLog(@"btDel") ; 375 | [self remove] ; 376 | } 377 | 378 | //- (void)btOriginalAction 379 | //{ 380 | // [self.delegate clickOriginalButton] ; 381 | //} 382 | 383 | @end 384 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/PasterChooseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PasterChooseView.h 3 | // subao 4 | // 5 | // Created by apple on 15/8/5. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PasterChooseViewDelegate 12 | - (void)pasterClick:(NSString *)paster ; 13 | @end 14 | 15 | @interface PasterChooseView : UIView 16 | @property (nonatomic,weak) id delegate ; 17 | @property (nonatomic,copy) NSString *aPaster ; 18 | @end 19 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/PasterChooseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PasterChooseView.m 3 | // subao 4 | // 5 | // Created by apple on 15/8/5. 6 | // Copyright (c) 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import "PasterChooseView.h" 10 | 11 | 12 | @interface PasterChooseView () 13 | @property (weak, nonatomic) IBOutlet UIImageView *imgPaster; 14 | @property (weak, nonatomic) IBOutlet UILabel *lb_namePaster; 15 | @property (weak, nonatomic) IBOutlet UIButton *bt_bg; 16 | @end 17 | 18 | @implementation PasterChooseView 19 | 20 | - (void)setAPaster:(NSString *)aPaster 21 | { 22 | _aPaster = aPaster ; 23 | 24 | _lb_namePaster.text = aPaster ; 25 | 26 | _imgPaster.image = [UIImage imageNamed:aPaster] ; 27 | } 28 | 29 | - (IBAction)btBackgroundClickAction:(id)sender 30 | { 31 | [self.delegate pasterClick:self.aPaster] ; 32 | } 33 | 34 | /* 35 | // Only override drawRect: if you perform custom drawing. 36 | // An empty implementation adversely affects performance during animation. 37 | - (void)drawRect:(CGRect)rect { 38 | // Drawing code 39 | } 40 | */ 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/PasterChooseView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/PasterController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PasterController.h 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PasterCtrllerDelegate 12 | - (void)pasterAddFinished:(UIImage *)imageFinished ; 13 | @end 14 | 15 | 16 | @interface PasterController : UIViewController 17 | @property (nonatomic,weak) id delegate ; 18 | @property (nonatomic,strong) UIImage *imageWillHandle ; 19 | @end 20 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/PasterController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PasterController.m 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import "PasterController.h" 10 | #import "PasterChooseView.h" 11 | #import "XTPasterStageView.h" 12 | #import "XTPasterView.h" 13 | 14 | #define APPFRAME [UIScreen mainScreen].bounds 15 | 16 | static const CGFloat width_pasterChoose = 110.0f ; 17 | 18 | @interface PasterController () 19 | // UIs 20 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollPaster; 21 | @property (strong, nonatomic) XTPasterStageView *stageView ; 22 | @property (weak, nonatomic) IBOutlet UIView *topBar; 23 | // Attrs 24 | @property (nonatomic,copy) NSArray *pasterList ; 25 | @end 26 | 27 | @implementation PasterController 28 | #pragma mark - PasterChooseViewDelegate 29 | - (void)pasterClick:(NSString *)paster 30 | { 31 | UIImage *image = [UIImage imageNamed:paster] ; 32 | 33 | if (!image) return ; 34 | 35 | //在这里 添加 贴纸 36 | [_stageView addPasterWithImg:image] ; 37 | } 38 | 39 | 40 | #pragma mark - Property 41 | - (NSArray *)pasterList 42 | { 43 | if (!_pasterList) 44 | { 45 | _pasterList = @[@"1",@"2",@"3",@"4",@"5"] ; 46 | } 47 | 48 | return _pasterList ; 49 | } 50 | 51 | #pragma mark - Actions 52 | - (IBAction)backButtonClickedAction:(id)sender 53 | { 54 | [self.navigationController popViewControllerAnimated:YES] ; 55 | } 56 | 57 | - (IBAction)nextButtonClickedAction:(id)sender 58 | { 59 | UIImage *imgResult = [_stageView doneEdit] ; 60 | [self.delegate pasterAddFinished:imgResult] ; 61 | [self.navigationController popViewControllerAnimated:YES] ; 62 | } 63 | 64 | #pragma mark - Life cycle 65 | - (void)setup 66 | { 67 | CGFloat sideFlex = 10.0f ; 68 | CGRect rectImage = CGRectZero ; 69 | CGFloat length = APPFRAME.size.width - sideFlex * 2 ; 70 | rectImage.size = CGSizeMake(length, length) ; 71 | CGFloat y = (APPFRAME.size.height - self.scrollPaster.frame.size.height - length) ; 72 | rectImage.origin.x = sideFlex ; 73 | rectImage.origin.y = y ; 74 | 75 | _stageView = [[XTPasterStageView alloc] initWithFrame:rectImage] ; 76 | _stageView.originImage = self.imageWillHandle ; 77 | _stageView.backgroundColor = [UIColor whiteColor] ; 78 | [self.view addSubview:_stageView] ; 79 | 80 | self.view.backgroundColor = [UIColor darkGrayColor] ; 81 | 82 | [self.view bringSubviewToFront:self.topBar] ; 83 | } 84 | 85 | - (void)viewDidLoad 86 | { 87 | [super viewDidLoad]; 88 | // Do any additional setup after loading the view. 89 | 90 | 91 | [self setup] ; 92 | [self scrollviewSetup] ; 93 | 94 | } 95 | 96 | 97 | - (void)scrollviewSetup 98 | { 99 | _scrollPaster.delegate = self ; 100 | _scrollPaster.pagingEnabled = NO ; 101 | _scrollPaster.showsVerticalScrollIndicator = NO ; 102 | _scrollPaster.showsHorizontalScrollIndicator = NO ; 103 | _scrollPaster.bounces = YES ; 104 | _scrollPaster.contentSize = CGSizeMake(width_pasterChoose * self.pasterList.count, 105 | self.scrollPaster.frame.size.height) ; 106 | 107 | int _x = 0 ; 108 | 109 | for (int i = 0; i < self.pasterList.count; i++) 110 | { 111 | CGRect rect = CGRectMake(_x, 0, width_pasterChoose, self.scrollPaster.frame.size.height) ; 112 | PasterChooseView *pView = (PasterChooseView *)[[[NSBundle mainBundle] loadNibNamed:@"PasterChooseView" owner:self options:nil] lastObject] ; 113 | pView.frame = rect ; 114 | 115 | pView.aPaster = self.pasterList[i] ; 116 | 117 | pView.delegate = self ; 118 | [_scrollPaster addSubview:pView] ; 119 | 120 | _x += width_pasterChoose ; 121 | } 122 | } 123 | 124 | #pragma mark - UIScrollView Delegate 125 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 126 | { 127 | 128 | } 129 | 130 | /* 131 | #pragma mark - Navigation 132 | 133 | // In a storyboard-based application, you will often want to do a little preparation before navigation 134 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 135 | // Get the new view controller using [segue destinationViewController]. 136 | // Pass the selected object to the new view controller. 137 | } 138 | */ 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/UIImage+AddFunction.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+AddFunction.h 3 | // 4 | // Created by mini1 on 14-6-13. 5 | // Copyright (c) 2014年 TEASON. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface UIImage (AddFunction) 11 | 12 | + (UIImage *)squareImageFromImage:(UIImage *)image 13 | scaledToSize:(CGFloat)newSize ; 14 | 15 | + (UIImage *)getImageFromView:(UIView *)theView ; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/UIImage+AddFunction.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+AddFunction.m 3 | // 4 | // 5 | // Created by mini1 on 14-6-13. 6 | // Copyright (c) 2014年 TEASON. All rights reserved. 7 | // 8 | 9 | #import "UIImage+AddFunction.h" 10 | 11 | @implementation UIImage (AddFunction) 12 | 13 | //裁剪正方 14 | /** 15 | * 剪切图片为正方形 16 | * 17 | * @param image 原始图片比如size大小为(400x200)pixels 18 | * @param newSize 正方形的size比如400pixels 19 | * 20 | * @return 返回正方形图片(400x400)pixels 21 | */ 22 | + (UIImage *)squareImageFromImage:(UIImage *)image scaledToSize:(CGFloat)newSize 23 | { 24 | CGAffineTransform scaleTransform; 25 | CGPoint origin; 26 | 27 | if (image.size.width > image.size.height) 28 | { 29 | //image原始高度为200,缩放image的高度为400pixels,所以缩放比率为2 30 | CGFloat scaleRatio = newSize / image.size.height; 31 | scaleTransform = CGAffineTransformMakeScale(scaleRatio, scaleRatio); 32 | //设置绘制原始图片的画笔坐标为CGPoint(-100, 0)pixels 33 | origin = CGPointMake(-(image.size.width - image.size.height) / 2.0f, 0); 34 | } 35 | else 36 | { 37 | CGFloat scaleRatio = newSize / image.size.width; 38 | scaleTransform = CGAffineTransformMakeScale(scaleRatio, scaleRatio); 39 | 40 | origin = CGPointMake(0, -(image.size.height - image.size.width) / 2.0f); 41 | } 42 | 43 | CGSize size = CGSizeMake(newSize, newSize); 44 | //创建画板为(400x400)pixels 45 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) 46 | { 47 | UIGraphicsBeginImageContextWithOptions(size, YES, 0); 48 | } 49 | else 50 | { 51 | UIGraphicsBeginImageContext(size); 52 | } 53 | 54 | CGContextRef context = UIGraphicsGetCurrentContext(); 55 | //将image原始图片(400x200)pixels缩放为(800x400)pixels 56 | CGContextConcatCTM(context, scaleTransform); 57 | //origin也会从原始(-100, 0)缩放到(-200, 0) 58 | [image drawAtPoint:origin]; 59 | 60 | //获取缩放后剪切的image图片 61 | image = UIGraphicsGetImageFromCurrentImageContext(); 62 | 63 | UIGraphicsEndImageContext(); 64 | 65 | return image; 66 | } 67 | 68 | // 将UIView转成UIImage 69 | + (UIImage *)getImageFromView:(UIView *)theView 70 | { 71 | CGSize orgSize = theView.bounds.size ; 72 | UIGraphicsBeginImageContextWithOptions(orgSize, YES, theView.layer.contentsScale * 2); 73 | [theView.layer renderInContext:UIGraphicsGetCurrentContext()] ; 74 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext() ; 75 | UIGraphicsEndImageContext() ; 76 | 77 | return image ; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "PasterController.h" 11 | 12 | @interface ViewController () 13 | @property (weak, nonatomic) IBOutlet UIImageView *imgView; 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (IBAction)addPastersAction:(id)sender { 19 | [self performSegueWithIdentifier:@"2paster" sender:nil] ; 20 | } 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | // Do any additional setup after loading the view, typically from a nib. 25 | 26 | [self.navigationController setNavigationBarHidden:YES] ; 27 | [[UIApplication sharedApplication] setStatusBarHidden:YES] ; 28 | } 29 | 30 | - (void)didReceiveMemoryWarning { 31 | [super didReceiveMemoryWarning]; 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | #pragma mark -- PasterCtrllerDelegate 36 | - (void)pasterAddFinished:(UIImage *)imageFinished 37 | { 38 | self.imgView.image = imageFinished ; 39 | } 40 | 41 | 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 43 | { 44 | // Get the new view controller using [segue destinationViewController]. 45 | // Pass the selected object to the new view controller. 46 | if ([segue.identifier isEqualToString:@"2paster"]) 47 | { 48 | PasterController *pasterCtrller = (PasterController *)[segue destinationViewController] ; 49 | pasterCtrller.imageWillHandle = self.imgView.image ; 50 | pasterCtrller.delegate = self ; 51 | } 52 | 53 | 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManager/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XTPasterManager 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. 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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManagerTests/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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManagerTests/XTPasterManagerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterManagerTests.m 3 | // XTPasterManagerTests 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XTPasterManagerTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation XTPasterManagerTests 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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManagerUITests/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 | -------------------------------------------------------------------------------- /XTPasterManager/XTPasterManagerUITests/XTPasterManagerUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XTPasterManagerUITests.m 3 | // XTPasterManagerUITests 4 | // 5 | // Created by TuTu on 15/10/16. 6 | // Copyright © 2015年 teason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XTPasterManagerUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation XTPasterManagerUITests 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 | --------------------------------------------------------------------------------