├── HWPopTool.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── HenryCheng.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── HWPopTool.xcscheme │ └── xcschememanagement.plist ├── HWPopTool ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── HWPoTools │ ├── HWPopTool.h │ └── HWPopTool.m ├── Info.plist ├── SecondViewController.h ├── SecondViewController.m ├── ViewController.h ├── ViewController.m ├── jei.png ├── main.m └── red_packge_close.png ├── HWPopToolTests ├── HWPopToolTests.m └── Info.plist ├── HWPopToolUITests ├── HWPopToolUITests.m └── Info.plist ├── README.md └── popView.gif /HWPopTool.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 922B3BF71C435C0D0001A162 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3BF61C435C0D0001A162 /* main.m */; }; 11 | 922B3BFA1C435C0D0001A162 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3BF91C435C0D0001A162 /* AppDelegate.m */; }; 12 | 922B3BFD1C435C0D0001A162 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3BFC1C435C0D0001A162 /* ViewController.m */; }; 13 | 922B3C001C435C0D0001A162 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 922B3BFE1C435C0D0001A162 /* Main.storyboard */; }; 14 | 922B3C021C435C0D0001A162 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 922B3C011C435C0D0001A162 /* Assets.xcassets */; }; 15 | 922B3C051C435C0D0001A162 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 922B3C031C435C0D0001A162 /* LaunchScreen.storyboard */; }; 16 | 922B3C101C435C0D0001A162 /* HWPopToolTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3C0F1C435C0D0001A162 /* HWPopToolTests.m */; }; 17 | 922B3C1B1C435C0D0001A162 /* HWPopToolUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3C1A1C435C0D0001A162 /* HWPopToolUITests.m */; }; 18 | 922B3C2C1C435CD20001A162 /* HWPopTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3C2B1C435CD20001A162 /* HWPopTool.m */; }; 19 | 922B3C301C437DAE0001A162 /* jei.png in Resources */ = {isa = PBXBuildFile; fileRef = 922B3C2F1C437DAE0001A162 /* jei.png */; }; 20 | 922B3C321C437EB70001A162 /* red_packge_close.png in Resources */ = {isa = PBXBuildFile; fileRef = 922B3C311C437EB70001A162 /* red_packge_close.png */; }; 21 | 922B3C351C4396AE0001A162 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 922B3C341C4396AE0001A162 /* SecondViewController.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 922B3C0C1C435C0D0001A162 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 922B3BEA1C435C0D0001A162 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 922B3BF11C435C0D0001A162; 30 | remoteInfo = HWPopTool; 31 | }; 32 | 922B3C171C435C0D0001A162 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 922B3BEA1C435C0D0001A162 /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 922B3BF11C435C0D0001A162; 37 | remoteInfo = HWPopTool; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 922B3BF21C435C0D0001A162 /* HWPopTool.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HWPopTool.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 922B3BF61C435C0D0001A162 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 44 | 922B3BF81C435C0D0001A162 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 922B3BF91C435C0D0001A162 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 922B3BFB1C435C0D0001A162 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 47 | 922B3BFC1C435C0D0001A162 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 48 | 922B3BFF1C435C0D0001A162 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | 922B3C011C435C0D0001A162 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | 922B3C041C435C0D0001A162 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | 922B3C061C435C0D0001A162 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 922B3C0B1C435C0D0001A162 /* HWPopToolTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HWPopToolTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 922B3C0F1C435C0D0001A162 /* HWPopToolTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HWPopToolTests.m; sourceTree = ""; }; 54 | 922B3C111C435C0D0001A162 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 922B3C161C435C0D0001A162 /* HWPopToolUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HWPopToolUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 922B3C1A1C435C0D0001A162 /* HWPopToolUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HWPopToolUITests.m; sourceTree = ""; }; 57 | 922B3C1C1C435C0D0001A162 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 922B3C2A1C435CD20001A162 /* HWPopTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HWPopTool.h; sourceTree = ""; }; 59 | 922B3C2B1C435CD20001A162 /* HWPopTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HWPopTool.m; sourceTree = ""; }; 60 | 922B3C2F1C437DAE0001A162 /* jei.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = jei.png; sourceTree = ""; }; 61 | 922B3C311C437EB70001A162 /* red_packge_close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = red_packge_close.png; sourceTree = ""; }; 62 | 922B3C331C4396AE0001A162 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 63 | 922B3C341C4396AE0001A162 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 922B3BEF1C435C0D0001A162 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 922B3C081C435C0D0001A162 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | 922B3C131C435C0D0001A162 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | /* End PBXFrameworksBuildPhase section */ 89 | 90 | /* Begin PBXGroup section */ 91 | 922B3BE91C435C0D0001A162 = { 92 | isa = PBXGroup; 93 | children = ( 94 | 922B3BF41C435C0D0001A162 /* HWPopTool */, 95 | 922B3C0E1C435C0D0001A162 /* HWPopToolTests */, 96 | 922B3C191C435C0D0001A162 /* HWPopToolUITests */, 97 | 922B3BF31C435C0D0001A162 /* Products */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 922B3BF31C435C0D0001A162 /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 922B3BF21C435C0D0001A162 /* HWPopTool.app */, 105 | 922B3C0B1C435C0D0001A162 /* HWPopToolTests.xctest */, 106 | 922B3C161C435C0D0001A162 /* HWPopToolUITests.xctest */, 107 | ); 108 | name = Products; 109 | sourceTree = ""; 110 | }; 111 | 922B3BF41C435C0D0001A162 /* HWPopTool */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 922B3C281C435C9E0001A162 /* HWPoTools */, 115 | 922B3BF81C435C0D0001A162 /* AppDelegate.h */, 116 | 922B3BF91C435C0D0001A162 /* AppDelegate.m */, 117 | 922B3BFB1C435C0D0001A162 /* ViewController.h */, 118 | 922B3BFC1C435C0D0001A162 /* ViewController.m */, 119 | 922B3C331C4396AE0001A162 /* SecondViewController.h */, 120 | 922B3C341C4396AE0001A162 /* SecondViewController.m */, 121 | 922B3BFE1C435C0D0001A162 /* Main.storyboard */, 122 | 922B3C011C435C0D0001A162 /* Assets.xcassets */, 123 | 922B3C031C435C0D0001A162 /* LaunchScreen.storyboard */, 124 | 922B3C061C435C0D0001A162 /* Info.plist */, 125 | 922B3BF51C435C0D0001A162 /* Supporting Files */, 126 | ); 127 | path = HWPopTool; 128 | sourceTree = ""; 129 | }; 130 | 922B3BF51C435C0D0001A162 /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 922B3C311C437EB70001A162 /* red_packge_close.png */, 134 | 922B3C2F1C437DAE0001A162 /* jei.png */, 135 | 922B3BF61C435C0D0001A162 /* main.m */, 136 | ); 137 | name = "Supporting Files"; 138 | sourceTree = ""; 139 | }; 140 | 922B3C0E1C435C0D0001A162 /* HWPopToolTests */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 922B3C0F1C435C0D0001A162 /* HWPopToolTests.m */, 144 | 922B3C111C435C0D0001A162 /* Info.plist */, 145 | ); 146 | path = HWPopToolTests; 147 | sourceTree = ""; 148 | }; 149 | 922B3C191C435C0D0001A162 /* HWPopToolUITests */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 922B3C1A1C435C0D0001A162 /* HWPopToolUITests.m */, 153 | 922B3C1C1C435C0D0001A162 /* Info.plist */, 154 | ); 155 | path = HWPopToolUITests; 156 | sourceTree = ""; 157 | }; 158 | 922B3C281C435C9E0001A162 /* HWPoTools */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 922B3C2A1C435CD20001A162 /* HWPopTool.h */, 162 | 922B3C2B1C435CD20001A162 /* HWPopTool.m */, 163 | ); 164 | path = HWPoTools; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXGroup section */ 168 | 169 | /* Begin PBXNativeTarget section */ 170 | 922B3BF11C435C0D0001A162 /* HWPopTool */ = { 171 | isa = PBXNativeTarget; 172 | buildConfigurationList = 922B3C1F1C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopTool" */; 173 | buildPhases = ( 174 | 922B3BEE1C435C0D0001A162 /* Sources */, 175 | 922B3BEF1C435C0D0001A162 /* Frameworks */, 176 | 922B3BF01C435C0D0001A162 /* Resources */, 177 | ); 178 | buildRules = ( 179 | ); 180 | dependencies = ( 181 | ); 182 | name = HWPopTool; 183 | productName = HWPopTool; 184 | productReference = 922B3BF21C435C0D0001A162 /* HWPopTool.app */; 185 | productType = "com.apple.product-type.application"; 186 | }; 187 | 922B3C0A1C435C0D0001A162 /* HWPopToolTests */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 922B3C221C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopToolTests" */; 190 | buildPhases = ( 191 | 922B3C071C435C0D0001A162 /* Sources */, 192 | 922B3C081C435C0D0001A162 /* Frameworks */, 193 | 922B3C091C435C0D0001A162 /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | 922B3C0D1C435C0D0001A162 /* PBXTargetDependency */, 199 | ); 200 | name = HWPopToolTests; 201 | productName = HWPopToolTests; 202 | productReference = 922B3C0B1C435C0D0001A162 /* HWPopToolTests.xctest */; 203 | productType = "com.apple.product-type.bundle.unit-test"; 204 | }; 205 | 922B3C151C435C0D0001A162 /* HWPopToolUITests */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 922B3C251C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopToolUITests" */; 208 | buildPhases = ( 209 | 922B3C121C435C0D0001A162 /* Sources */, 210 | 922B3C131C435C0D0001A162 /* Frameworks */, 211 | 922B3C141C435C0D0001A162 /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | 922B3C181C435C0D0001A162 /* PBXTargetDependency */, 217 | ); 218 | name = HWPopToolUITests; 219 | productName = HWPopToolUITests; 220 | productReference = 922B3C161C435C0D0001A162 /* HWPopToolUITests.xctest */; 221 | productType = "com.apple.product-type.bundle.ui-testing"; 222 | }; 223 | /* End PBXNativeTarget section */ 224 | 225 | /* Begin PBXProject section */ 226 | 922B3BEA1C435C0D0001A162 /* Project object */ = { 227 | isa = PBXProject; 228 | attributes = { 229 | LastUpgradeCheck = 0720; 230 | ORGANIZATIONNAME = www.igancao.com; 231 | TargetAttributes = { 232 | 922B3BF11C435C0D0001A162 = { 233 | CreatedOnToolsVersion = 7.2; 234 | }; 235 | 922B3C0A1C435C0D0001A162 = { 236 | CreatedOnToolsVersion = 7.2; 237 | TestTargetID = 922B3BF11C435C0D0001A162; 238 | }; 239 | 922B3C151C435C0D0001A162 = { 240 | CreatedOnToolsVersion = 7.2; 241 | TestTargetID = 922B3BF11C435C0D0001A162; 242 | }; 243 | }; 244 | }; 245 | buildConfigurationList = 922B3BED1C435C0D0001A162 /* Build configuration list for PBXProject "HWPopTool" */; 246 | compatibilityVersion = "Xcode 3.2"; 247 | developmentRegion = English; 248 | hasScannedForEncodings = 0; 249 | knownRegions = ( 250 | en, 251 | Base, 252 | ); 253 | mainGroup = 922B3BE91C435C0D0001A162; 254 | productRefGroup = 922B3BF31C435C0D0001A162 /* Products */; 255 | projectDirPath = ""; 256 | projectRoot = ""; 257 | targets = ( 258 | 922B3BF11C435C0D0001A162 /* HWPopTool */, 259 | 922B3C0A1C435C0D0001A162 /* HWPopToolTests */, 260 | 922B3C151C435C0D0001A162 /* HWPopToolUITests */, 261 | ); 262 | }; 263 | /* End PBXProject section */ 264 | 265 | /* Begin PBXResourcesBuildPhase section */ 266 | 922B3BF01C435C0D0001A162 /* Resources */ = { 267 | isa = PBXResourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 922B3C301C437DAE0001A162 /* jei.png in Resources */, 271 | 922B3C051C435C0D0001A162 /* LaunchScreen.storyboard in Resources */, 272 | 922B3C321C437EB70001A162 /* red_packge_close.png in Resources */, 273 | 922B3C021C435C0D0001A162 /* Assets.xcassets in Resources */, 274 | 922B3C001C435C0D0001A162 /* Main.storyboard in Resources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 922B3C091C435C0D0001A162 /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | 922B3C141C435C0D0001A162 /* Resources */ = { 286 | isa = PBXResourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | /* End PBXResourcesBuildPhase section */ 293 | 294 | /* Begin PBXSourcesBuildPhase section */ 295 | 922B3BEE1C435C0D0001A162 /* Sources */ = { 296 | isa = PBXSourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | 922B3C351C4396AE0001A162 /* SecondViewController.m in Sources */, 300 | 922B3BFD1C435C0D0001A162 /* ViewController.m in Sources */, 301 | 922B3BFA1C435C0D0001A162 /* AppDelegate.m in Sources */, 302 | 922B3C2C1C435CD20001A162 /* HWPopTool.m in Sources */, 303 | 922B3BF71C435C0D0001A162 /* main.m in Sources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 922B3C071C435C0D0001A162 /* Sources */ = { 308 | isa = PBXSourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | 922B3C101C435C0D0001A162 /* HWPopToolTests.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | 922B3C121C435C0D0001A162 /* Sources */ = { 316 | isa = PBXSourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | 922B3C1B1C435C0D0001A162 /* HWPopToolUITests.m in Sources */, 320 | ); 321 | runOnlyForDeploymentPostprocessing = 0; 322 | }; 323 | /* End PBXSourcesBuildPhase section */ 324 | 325 | /* Begin PBXTargetDependency section */ 326 | 922B3C0D1C435C0D0001A162 /* PBXTargetDependency */ = { 327 | isa = PBXTargetDependency; 328 | target = 922B3BF11C435C0D0001A162 /* HWPopTool */; 329 | targetProxy = 922B3C0C1C435C0D0001A162 /* PBXContainerItemProxy */; 330 | }; 331 | 922B3C181C435C0D0001A162 /* PBXTargetDependency */ = { 332 | isa = PBXTargetDependency; 333 | target = 922B3BF11C435C0D0001A162 /* HWPopTool */; 334 | targetProxy = 922B3C171C435C0D0001A162 /* PBXContainerItemProxy */; 335 | }; 336 | /* End PBXTargetDependency section */ 337 | 338 | /* Begin PBXVariantGroup section */ 339 | 922B3BFE1C435C0D0001A162 /* Main.storyboard */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | 922B3BFF1C435C0D0001A162 /* Base */, 343 | ); 344 | name = Main.storyboard; 345 | sourceTree = ""; 346 | }; 347 | 922B3C031C435C0D0001A162 /* LaunchScreen.storyboard */ = { 348 | isa = PBXVariantGroup; 349 | children = ( 350 | 922B3C041C435C0D0001A162 /* Base */, 351 | ); 352 | name = LaunchScreen.storyboard; 353 | sourceTree = ""; 354 | }; 355 | /* End PBXVariantGroup section */ 356 | 357 | /* Begin XCBuildConfiguration section */ 358 | 922B3C1D1C435C0D0001A162 /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ALWAYS_SEARCH_USER_PATHS = NO; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_CONSTANT_CONVERSION = YES; 368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 369 | CLANG_WARN_EMPTY_BODY = YES; 370 | CLANG_WARN_ENUM_CONVERSION = YES; 371 | CLANG_WARN_INT_CONVERSION = YES; 372 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 376 | COPY_PHASE_STRIP = NO; 377 | DEBUG_INFORMATION_FORMAT = dwarf; 378 | ENABLE_STRICT_OBJC_MSGSEND = YES; 379 | ENABLE_TESTABILITY = YES; 380 | GCC_C_LANGUAGE_STANDARD = gnu99; 381 | GCC_DYNAMIC_NO_PIC = NO; 382 | GCC_NO_COMMON_BLOCKS = YES; 383 | GCC_OPTIMIZATION_LEVEL = 0; 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 389 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 390 | GCC_WARN_UNDECLARED_SELECTOR = YES; 391 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 392 | GCC_WARN_UNUSED_FUNCTION = YES; 393 | GCC_WARN_UNUSED_VARIABLE = YES; 394 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 395 | MTL_ENABLE_DEBUG_INFO = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | }; 400 | name = Debug; 401 | }; 402 | 922B3C1E1C435C0D0001A162 /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_SEARCH_USER_PATHS = NO; 406 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 407 | CLANG_CXX_LIBRARY = "libc++"; 408 | CLANG_ENABLE_MODULES = YES; 409 | CLANG_ENABLE_OBJC_ARC = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_CONSTANT_CONVERSION = YES; 412 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 413 | CLANG_WARN_EMPTY_BODY = YES; 414 | CLANG_WARN_ENUM_CONVERSION = YES; 415 | CLANG_WARN_INT_CONVERSION = YES; 416 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 417 | CLANG_WARN_UNREACHABLE_CODE = YES; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 420 | COPY_PHASE_STRIP = NO; 421 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 422 | ENABLE_NS_ASSERTIONS = NO; 423 | ENABLE_STRICT_OBJC_MSGSEND = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu99; 425 | GCC_NO_COMMON_BLOCKS = YES; 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNDECLARED_SELECTOR = YES; 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 430 | GCC_WARN_UNUSED_FUNCTION = YES; 431 | GCC_WARN_UNUSED_VARIABLE = YES; 432 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 433 | MTL_ENABLE_DEBUG_INFO = NO; 434 | SDKROOT = iphoneos; 435 | TARGETED_DEVICE_FAMILY = "1,2"; 436 | VALIDATE_PRODUCT = YES; 437 | }; 438 | name = Release; 439 | }; 440 | 922B3C201C435C0D0001A162 /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | INFOPLIST_FILE = HWPopTool/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 446 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopTool; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | }; 449 | name = Debug; 450 | }; 451 | 922B3C211C435C0D0001A162 /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 455 | INFOPLIST_FILE = HWPopTool/Info.plist; 456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 457 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopTool; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | }; 460 | name = Release; 461 | }; 462 | 922B3C231C435C0D0001A162 /* Debug */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | BUNDLE_LOADER = "$(TEST_HOST)"; 466 | INFOPLIST_FILE = HWPopToolTests/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 468 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopToolTests; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HWPopTool.app/HWPopTool"; 471 | }; 472 | name = Debug; 473 | }; 474 | 922B3C241C435C0D0001A162 /* Release */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | BUNDLE_LOADER = "$(TEST_HOST)"; 478 | INFOPLIST_FILE = HWPopToolTests/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopToolTests; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HWPopTool.app/HWPopTool"; 483 | }; 484 | name = Release; 485 | }; 486 | 922B3C261C435C0D0001A162 /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | INFOPLIST_FILE = HWPopToolUITests/Info.plist; 490 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 491 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopToolUITests; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TEST_TARGET_NAME = HWPopTool; 494 | USES_XCTRUNNER = YES; 495 | }; 496 | name = Debug; 497 | }; 498 | 922B3C271C435C0D0001A162 /* Release */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | INFOPLIST_FILE = HWPopToolUITests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 503 | PRODUCT_BUNDLE_IDENTIFIER = Loveway.HWPopToolUITests; 504 | PRODUCT_NAME = "$(TARGET_NAME)"; 505 | TEST_TARGET_NAME = HWPopTool; 506 | USES_XCTRUNNER = YES; 507 | }; 508 | name = Release; 509 | }; 510 | /* End XCBuildConfiguration section */ 511 | 512 | /* Begin XCConfigurationList section */ 513 | 922B3BED1C435C0D0001A162 /* Build configuration list for PBXProject "HWPopTool" */ = { 514 | isa = XCConfigurationList; 515 | buildConfigurations = ( 516 | 922B3C1D1C435C0D0001A162 /* Debug */, 517 | 922B3C1E1C435C0D0001A162 /* Release */, 518 | ); 519 | defaultConfigurationIsVisible = 0; 520 | defaultConfigurationName = Release; 521 | }; 522 | 922B3C1F1C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopTool" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 922B3C201C435C0D0001A162 /* Debug */, 526 | 922B3C211C435C0D0001A162 /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | }; 530 | 922B3C221C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopToolTests" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | 922B3C231C435C0D0001A162 /* Debug */, 534 | 922B3C241C435C0D0001A162 /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | }; 538 | 922B3C251C435C0D0001A162 /* Build configuration list for PBXNativeTarget "HWPopToolUITests" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 922B3C261C435C0D0001A162 /* Debug */, 542 | 922B3C271C435C0D0001A162 /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | }; 546 | /* End XCConfigurationList section */ 547 | }; 548 | rootObject = 922B3BEA1C435C0D0001A162 /* Project object */; 549 | } 550 | -------------------------------------------------------------------------------- /HWPopTool.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HWPopTool.xcodeproj/xcuserdata/HenryCheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /HWPopTool.xcodeproj/xcuserdata/HenryCheng.xcuserdatad/xcschemes/HWPopTool.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 | -------------------------------------------------------------------------------- /HWPopTool.xcodeproj/xcuserdata/HenryCheng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HWPopTool.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 922B3BF11C435C0D0001A162 16 | 17 | primary 18 | 19 | 20 | 922B3C0A1C435C0D0001A162 21 | 22 | primary 23 | 24 | 25 | 922B3C151C435C0D0001A162 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /HWPopTool/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. 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 | -------------------------------------------------------------------------------- /HWPopTool/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | 23 | ViewController *vc = [[ViewController alloc]init]; 24 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; 25 | self.window.rootViewController = nav; 26 | [self.window makeKeyAndVisible]; 27 | 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // 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. 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application { 46 | // 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. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /HWPopTool/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /HWPopTool/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 | -------------------------------------------------------------------------------- /HWPopTool/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /HWPopTool/HWPoTools/HWPopTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // HWPopTool.h 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | /** 12 | * 关闭按钮的位置 13 | */ 14 | typedef NS_ENUM(NSInteger, ButtonPositionType) { 15 | /** 16 | * 无 17 | */ 18 | ButtonPositionTypeNone = 0, 19 | /** 20 | * 左上角 21 | */ 22 | ButtonPositionTypeLeft = 1 << 0, 23 | /** 24 | * 右上角 25 | */ 26 | ButtonPositionTypeRight = 2 << 0 27 | }; 28 | /** 29 | * 蒙板的背景色 30 | */ 31 | typedef NS_ENUM(NSInteger, ShadeBackgroundType) { 32 | /** 33 | * 渐变色 34 | */ 35 | ShadeBackgroundTypeGradient = 0, 36 | /** 37 | * 固定色 38 | */ 39 | ShadeBackgroundTypeSolid = 1 << 0 40 | }; 41 | 42 | typedef void(^completeBlock)(void); 43 | 44 | @interface HWPopTool : NSObject 45 | 46 | @property (strong, nonatomic) UIColor *popBackgroudColor;//弹出视图的背景色 47 | @property (assign, nonatomic) BOOL tapOutsideToDismiss;//点击蒙板是否弹出视图消失 48 | @property (assign, nonatomic) ButtonPositionType closeButtonType;//关闭按钮的类型 49 | @property (assign, nonatomic) ShadeBackgroundType shadeBackgroundType;//蒙板的背景色 50 | 51 | /** 52 | * 创建一个实例 53 | * 54 | * @return CHWPopTool 55 | */ 56 | + (HWPopTool *)sharedInstance; 57 | /** 58 | * 弹出要展示的View 59 | * 60 | * @param presentView show View 61 | * @param animated 是否动画 62 | */ 63 | - (void)showWithPresentView:(UIView *)presentView animated:(BOOL)animated; 64 | /** 65 | * 关闭弹出视图 66 | * 67 | * @param complete complete block 68 | */ 69 | - (void)closeWithBlcok:(void(^)())complete; 70 | 71 | @end 72 | 73 | -------------------------------------------------------------------------------- /HWPopTool/HWPoTools/HWPopTool.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // HWPopTool.m 4 | // HWPopTool 5 | // 6 | // Created by HenryCheng on 16/1/11. 7 | // Copyright © 2016年 www.igancao.com. All rights reserved. 8 | // 9 | 10 | #import "HWPopTool.h" 11 | 12 | static NSTimeInterval const kFadeInAnimationDuration = 0.7; 13 | static NSTimeInterval const kTransformPart1AnimationDuration = 0.3; 14 | static NSTimeInterval const kTransformPart2AnimationDuration = 0.4; 15 | static CGFloat const kDefaultCloseButtonPadding = 17.0f; 16 | 17 | /** 18 | * 自定义的view 19 | */ 20 | @interface MyView : UIView 21 | @property (weak, nonatomic) CALayer *styleLayer; 22 | @property (strong, nonatomic) UIColor *popBackgroundColor; 23 | @end 24 | 25 | //遮罩 26 | @interface shadeView : UIView 27 | 28 | @end 29 | 30 | /** 31 | * 自定义的VC 32 | */ 33 | @interface MyViewController : UIViewController 34 | @property (weak, nonatomic) shadeView *styleView; 35 | @end 36 | 37 | /** 38 | * 自定义的button 39 | */ 40 | @interface MyButton : UIButton 41 | 42 | @end 43 | 44 | /** 45 | * HWPopTool 46 | */ 47 | @interface HWPopTool () 48 | @property (strong, nonatomic) UIWindow *window; 49 | @property (strong, nonatomic) UIViewController *contentViewController; 50 | @property (weak, nonatomic) MyViewController *viewController; 51 | @property (weak, nonatomic) MyView *containerView; 52 | @property (weak, nonatomic) MyButton *closeButton; 53 | 54 | @end 55 | 56 | @implementation HWPopTool 57 | 58 | + (HWPopTool *)sharedInstance { 59 | static HWPopTool *sharedClient = nil; 60 | static dispatch_once_t onceToken; 61 | dispatch_once(&onceToken, ^{ 62 | sharedClient = [[HWPopTool alloc]init]; 63 | }); 64 | return sharedClient; 65 | } 66 | 67 | - (instancetype)init { 68 | self = [super init]; 69 | if (self) { 70 | self.closeButtonType = ButtonPositionTypeLeft; 71 | self.tapOutsideToDismiss = YES; 72 | self.popBackgroudColor = [UIColor colorWithWhite:0 alpha:0.5]; 73 | }; 74 | return self; 75 | } 76 | 77 | - (void)setCloseButtonType:(ButtonPositionType)closeButtonType { 78 | 79 | _closeButtonType = closeButtonType; 80 | if (closeButtonType == ButtonPositionTypeNone) { 81 | [self.closeButton setHidden:YES]; 82 | } else { 83 | [self.closeButton setHidden:NO]; 84 | 85 | CGRect closeFrame = self.closeButton.frame; 86 | if(closeButtonType == ButtonPositionTypeRight){ 87 | closeFrame.origin.x = round(CGRectGetWidth(self.containerView.frame) - kDefaultCloseButtonPadding - CGRectGetWidth(closeFrame)/2); 88 | } else { 89 | closeFrame.origin.x = 0; 90 | } 91 | self.closeButton.frame = closeFrame; 92 | } 93 | } 94 | 95 | - (void)showWithPresentView:(UIView *)presentView animated:(BOOL)animated { 96 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 97 | self.window.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 98 | self.window.opaque = NO; 99 | 100 | MyViewController *viewController = [[MyViewController alloc] init]; 101 | self.window.rootViewController = viewController; 102 | self.viewController = viewController; 103 | 104 | CGFloat padding = 17; 105 | CGRect containerViewRect = CGRectInset(presentView.bounds, -padding, -padding); 106 | containerViewRect.origin.x = containerViewRect.origin.y = 0; 107 | containerViewRect.origin.x = round(CGRectGetMidX(self.window.bounds) - CGRectGetMidX(containerViewRect)); 108 | containerViewRect.origin.y = round(CGRectGetMidY(self.window.bounds) - CGRectGetMidY(containerViewRect)); 109 | MyView *containerView = [[MyView alloc] initWithFrame:containerViewRect]; 110 | containerView.popBackgroundColor = self.popBackgroudColor; 111 | containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin| 112 | UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin; 113 | containerView.layer.rasterizationScale = [[UIScreen mainScreen] scale]; 114 | presentView.frame = (CGRect){padding, padding, presentView.bounds.size}; 115 | [containerView addSubview:presentView]; 116 | [viewController.view addSubview:containerView]; 117 | self.containerView = containerView; 118 | 119 | MyButton *closeButton = [[MyButton alloc] init]; 120 | 121 | if(self.closeButtonType == ButtonPositionTypeRight){ 122 | CGRect closeFrame = closeButton.frame; 123 | closeFrame.origin.x = CGRectGetWidth(containerView.bounds)-CGRectGetWidth(closeFrame); 124 | closeButton.frame = closeFrame; 125 | } 126 | 127 | [closeButton addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside]; 128 | [containerView addSubview:closeButton]; 129 | self.closeButton = closeButton; 130 | [self setCloseButtonType:self.closeButtonType]; 131 | 132 | dispatch_async(dispatch_get_main_queue(), ^{ 133 | [self.window makeKeyAndVisible]; 134 | if(animated){ 135 | viewController.styleView.alpha = 0; 136 | [UIView animateWithDuration:kFadeInAnimationDuration animations:^{ 137 | viewController.styleView.alpha = 1; 138 | }]; 139 | containerView.alpha = 0; 140 | containerView.layer.shouldRasterize = YES; 141 | containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.0, 0.0); 142 | [UIView animateWithDuration:kTransformPart1AnimationDuration animations:^{ 143 | containerView.alpha = 1; 144 | containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.2, 1.2); 145 | } completion:^(BOOL finished) { 146 | [UIView animateWithDuration:.2 animations:^{ 147 | containerView.alpha = 1; 148 | containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.8, 0.8); 149 | } completion:^(BOOL finished) { 150 | [UIView animateWithDuration:kTransformPart2AnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 151 | containerView.alpha = 1; 152 | containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1, 1); 153 | } completion:^(BOOL finished2) { 154 | containerView.layer.shouldRasterize = NO; 155 | }]; 156 | 157 | }]; 158 | }]; 159 | } 160 | }); 161 | 162 | } 163 | 164 | - (void)close { 165 | [self hideAnimated:YES withCompletionBlock:nil]; 166 | 167 | } 168 | - (void)closeWithBlcok:(void(^)())complete { 169 | [self hideAnimated:YES withCompletionBlock:complete]; 170 | } 171 | 172 | - (void)hideAnimated:(BOOL)animated withCompletionBlock:(void(^)())completion { 173 | if(!animated){ 174 | [self cleanup]; 175 | return; 176 | } 177 | dispatch_async(dispatch_get_main_queue(), ^{ 178 | [UIView animateWithDuration:kFadeInAnimationDuration animations:^{ 179 | self.viewController.styleView.alpha = 0; 180 | }]; 181 | 182 | self.containerView.layer.shouldRasterize = YES; 183 | [UIView animateWithDuration:kTransformPart2AnimationDuration animations:^{ 184 | self.containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.2, 1.2); 185 | } completion:^(BOOL finished){ 186 | [UIView animateWithDuration:kTransformPart1AnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 187 | self.containerView.alpha = 0; 188 | self.containerView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.0, 0.0); 189 | } completion:^(BOOL finished2){ 190 | [self cleanup]; 191 | if(completion){ 192 | completion(); 193 | } 194 | }]; 195 | }]; 196 | }); 197 | 198 | } 199 | 200 | - (void)cleanup{ 201 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 202 | [self.containerView removeFromSuperview]; 203 | [[[[UIApplication sharedApplication] delegate] window] makeKeyWindow]; 204 | [self.window removeFromSuperview]; 205 | self.contentViewController = nil; 206 | self.window = nil; 207 | } 208 | - (void)dealloc{ 209 | [self cleanup]; 210 | } 211 | 212 | 213 | @end 214 | 215 | /** 216 | * 自定义的VC 217 | */ 218 | @implementation MyViewController 219 | 220 | - (void)loadView { 221 | self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 222 | } 223 | 224 | - (void)viewDidLoad { 225 | [super viewDidLoad]; 226 | 227 | self.view.backgroundColor = [UIColor clearColor]; 228 | self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 229 | 230 | shadeView *styleView = [[shadeView alloc] initWithFrame:self.view.bounds]; 231 | styleView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 232 | styleView.opaque = NO; 233 | [self.view addSubview:styleView]; 234 | self.styleView = styleView; 235 | } 236 | 237 | 238 | @end 239 | 240 | /** 241 | * 自定义的View 242 | */ 243 | @implementation MyView 244 | 245 | - (instancetype)initWithFrame:(CGRect)frame { 246 | 247 | self = [super initWithFrame:frame]; 248 | if (!self) { 249 | CALayer *styleLayer = [[CALayer alloc] init]; 250 | styleLayer.cornerRadius = 4; 251 | styleLayer.shadowColor= [[UIColor whiteColor] CGColor]; 252 | styleLayer.shadowOffset = CGSizeMake(0, 0); 253 | styleLayer.shadowOpacity = 0.5; 254 | styleLayer.borderWidth = 1; 255 | styleLayer.borderColor = [[UIColor whiteColor] CGColor]; 256 | styleLayer.frame = CGRectInset(self.bounds, 12, 12); 257 | [self.layer addSublayer:styleLayer]; 258 | self.styleLayer = styleLayer; 259 | 260 | } 261 | return self; 262 | } 263 | 264 | - (void)setPopBackgroundColor:(UIColor *)popBackgroundColor { 265 | if(_popBackgroundColor != popBackgroundColor){ 266 | _popBackgroundColor = popBackgroundColor; 267 | self.styleLayer.backgroundColor = [popBackgroundColor CGColor]; 268 | } 269 | } 270 | 271 | @end 272 | 273 | //遮罩 274 | @implementation shadeView 275 | 276 | - (void)drawRect:(CGRect)rect{ 277 | CGContextRef context = UIGraphicsGetCurrentContext(); 278 | 279 | if ([HWPopTool sharedInstance].shadeBackgroundType == ShadeBackgroundTypeSolid) { 280 | [[UIColor colorWithWhite:0 alpha:0.55] set]; 281 | CGContextFillRect(context, self.bounds); 282 | } else { 283 | CGContextSaveGState(context); 284 | size_t gradLocationsNum = 2; 285 | CGFloat gradLocations[2] = {0.0f, 1.0f}; 286 | CGFloat gradColors[8] = {0, 0, 0, 0.3, 0, 0, 0, 0.8}; 287 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 288 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradColors, gradLocations, gradLocationsNum); 289 | CGColorSpaceRelease(colorSpace), colorSpace = NULL; 290 | CGPoint gradCenter= CGPointMake(round(CGRectGetMidX(self.bounds)), round(CGRectGetMidY(self.bounds))); 291 | CGFloat gradRadius = MAX(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)); 292 | CGContextDrawRadialGradient(context, gradient, gradCenter, 0, gradCenter, gradRadius, kCGGradientDrawsAfterEndLocation); 293 | CGGradientRelease(gradient), gradient = NULL; 294 | CGContextRestoreGState(context); 295 | } 296 | } 297 | 298 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 299 | if ([HWPopTool sharedInstance].tapOutsideToDismiss) { 300 | [[HWPopTool sharedInstance] hideAnimated:YES withCompletionBlock:nil]; 301 | } 302 | } 303 | 304 | @end 305 | 306 | /** 307 | 自定义的button 308 | 309 | - returns: button 310 | */ 311 | @implementation MyButton 312 | 313 | - (instancetype)init { 314 | 315 | self = [super initWithFrame:(CGRect){0, 0, 32, 32}]; 316 | if (self) { 317 | 318 | [self setBackgroundImage:[UIImage imageNamed:@"red_packge_close"] forState:UIControlStateNormal]; 319 | // self.backgroundColor = [UIColor greenColor]; 320 | } 321 | return self; 322 | } 323 | 324 | 325 | @end 326 | -------------------------------------------------------------------------------- /HWPopTool/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /HWPopTool/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HWPopTool/SecondViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // SecondViewController.m 4 | // HWPopTool 5 | // 6 | // Created by HenryCheng on 16/1/11. 7 | // Copyright © 2016年 www.igancao.com. All rights reserved. 8 | // 9 | 10 | #import "SecondViewController.h" 11 | #import "HWPopTool.h" 12 | 13 | @interface SecondViewController () 14 | 15 | @property (strong, nonatomic) UIView *contentView; 16 | @property (strong, nonatomic) UIButton *popBtn; 17 | 18 | @end 19 | 20 | @implementation SecondViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.view.backgroundColor = [UIColor whiteColor]; 25 | 26 | _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 300)]; 27 | _contentView.backgroundColor = [UIColor clearColor]; 28 | 29 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 30 | btn.frame = CGRectMake(100, 200, 100, 50); 31 | btn.backgroundColor = [UIColor greenColor]; 32 | [btn addTarget:self action:@selector(popViewShow) forControlEvents:UIControlEventTouchUpInside]; 33 | [self.view addSubview:btn]; 34 | 35 | _popBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 36 | _popBtn.frame = CGRectMake(0, 250, 200, 50); 37 | _popBtn.backgroundColor = [UIColor greenColor]; 38 | [_popBtn addTarget:self action:@selector(closeAndBack) forControlEvents:UIControlEventTouchUpInside]; 39 | 40 | } 41 | 42 | - (void)popViewShow { 43 | UIImageView *imageV = [[UIImageView alloc]initWithFrame:_contentView.bounds]; 44 | imageV.image = [UIImage imageNamed:@"jei"]; 45 | [_contentView addSubview:imageV]; 46 | // 看看pop效果把下面这一句加上 47 | // [_contentView addSubview:_popBtn]; 48 | 49 | [HWPopTool sharedInstance].shadeBackgroundType = ShadeBackgroundTypeSolid; 50 | [HWPopTool sharedInstance].closeButtonType = ButtonPositionTypeRight; 51 | [[HWPopTool sharedInstance] showWithPresentView:_contentView animated:YES]; 52 | 53 | } 54 | 55 | - (void)closeAndBack { 56 | [[HWPopTool sharedInstance] closeWithBlcok:^{ 57 | [self.navigationController popViewControllerAnimated:YES]; 58 | 59 | }]; 60 | } 61 | 62 | 63 | - (void)didReceiveMemoryWarning { 64 | [super didReceiveMemoryWarning]; 65 | // Dispose of any resources that can be recreated. 66 | } 67 | 68 | /* 69 | #pragma mark - Navigation 70 | 71 | // In a storyboard-based application, you will often want to do a little preparation before navigation 72 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 73 | // Get the new view controller using [segue destinationViewController]. 74 | // Pass the selected object to the new view controller. 75 | } 76 | */ 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /HWPopTool/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /HWPopTool/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 23 | btn.frame = CGRectMake(100, 100, 100, 50); 24 | btn.backgroundColor = [UIColor greenColor]; 25 | [btn addTarget:self action:@selector(pushNext) forControlEvents:UIControlEventTouchUpInside]; 26 | [self.view addSubview:btn]; 27 | 28 | } 29 | 30 | - (void)pushNext { 31 | Class class = NSClassFromString(@"SecondViewController"); 32 | if (class) { 33 | UIViewController *vc = [class new]; 34 | [self.navigationController pushViewController:vc animated:YES]; 35 | } 36 | 37 | } 38 | 39 | - (void)didReceiveMemoryWarning { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /HWPopTool/jei.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveway/HWPopTool/31cd035c63c0d94fd04f9f311fb1c6f731a55fb5/HWPopTool/jei.png -------------------------------------------------------------------------------- /HWPopTool/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HWPopTool 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HWPopTool/red_packge_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveway/HWPopTool/31cd035c63c0d94fd04f9f311fb1c6f731a55fb5/HWPopTool/red_packge_close.png -------------------------------------------------------------------------------- /HWPopToolTests/HWPopToolTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HWPopToolTests.m 3 | // HWPopToolTests 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HWPopToolTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HWPopToolTests 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 | -------------------------------------------------------------------------------- /HWPopToolTests/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 | -------------------------------------------------------------------------------- /HWPopToolUITests/HWPopToolUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // HWPopToolUITests.m 3 | // HWPopToolUITests 4 | // 5 | // Created by HenryCheng on 16/1/11. 6 | // Copyright © 2016年 www.igancao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HWPopToolUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation HWPopToolUITests 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 | -------------------------------------------------------------------------------- /HWPopToolUITests/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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HWPopTool 2 | 一个封装的弹出视图(popView) 3 | 4 | 效果图如下: 5 | 6 | ![效果图](https://github.com/Loveway/HWPopTool/blob/master/popView.gif) 7 | 8 | 详情请见[我的简书](http://www.jianshu.com/p/68b19be19738) 9 | -------------------------------------------------------------------------------- /popView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loveway/HWPopTool/31cd035c63c0d94fd04f9f311fb1c6f731a55fb5/popView.gif --------------------------------------------------------------------------------