├── .gitignore ├── LICENCE ├── PSAlertView.podspec ├── PSAlertViewExample ├── PSAlertViewExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── PSAlertViewExample.xccheckout └── PSAlertViewExample │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── PSAlertViewExample-Info.plist │ ├── PSAlertViewExample-Prefix.pch │ ├── PSCAppDelegate.h │ ├── PSCAppDelegate.m │ ├── PSCViewController.h │ ├── PSCViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── PSCViewController_iPad.xib │ └── PSCViewController_iPhone.xib │ └── main.m ├── PSPDFActionSheet.h ├── PSPDFActionSheet.m ├── PSPDFAlertView.h ├── PSPDFAlertView.m ├── PSPDFAlertView.xcodeproj └── project.pbxproj └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | #### `.gitignore` 2 | # xcode noise 3 | build/* 4 | *.mode1v3 5 | 6 | # SVN directories 7 | .svn 8 | 9 | # osx noise 10 | .DS_Store 11 | profile 12 | xcuserdata -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Peter Steinberger, PSPDFKit GmbH 2 | This code is a part of http://PSPDFKit.com and has been put under MIT license. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | 23 | PSPDFAlertView.m also contains drawing code by Michał Zaborowski. 24 | 25 | Created by Michał Zaborowski on 18/07/12. 26 | Copyright (c) 2012 Michał Zaborowski. All rights reserved. 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy 29 | of this software and associated documentation files (the "Software"), to deal 30 | in the Software without restriction, including without limitation the rights 31 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | copies of the Software, and to permit persons to whom the Software is furnished 33 | to do so, subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in all 36 | copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 | THE SOFTWARE. 45 | -------------------------------------------------------------------------------- /PSAlertView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PSAlertView' 3 | s.version = '2.0.3' 4 | s.summary = "Modern block-based wrappers for UIAlertView and UIActionSheet." 5 | s.homepage = "https://github.com/steipete/PSAlertView" 6 | s.author = { 'Peter Steinberger' => 'peter@pspdfkit.com' } 7 | s.source = { :git => 'https://github.com/steipete/PSAlertView.git', :tag => '2.0.3' } 8 | s.platform = :ios, '6.0' 9 | s.requires_arc = true 10 | s.source_files = '*.{h,m}' 11 | s.license = 'MIT' 12 | end 13 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 78CCD0F0168C5E4A00E09A4F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78CCD0EF168C5E4A00E09A4F /* UIKit.framework */; }; 11 | 78CCD0F2168C5E4A00E09A4F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78CCD0F1168C5E4A00E09A4F /* Foundation.framework */; }; 12 | 78CCD0F4168C5E4A00E09A4F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78CCD0F3168C5E4A00E09A4F /* CoreGraphics.framework */; }; 13 | 78CCD0FA168C5E4A00E09A4F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD0F8168C5E4A00E09A4F /* InfoPlist.strings */; }; 14 | 78CCD0FC168C5E4A00E09A4F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CCD0FB168C5E4A00E09A4F /* main.m */; }; 15 | 78CCD100168C5E4A00E09A4F /* PSCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CCD0FF168C5E4A00E09A4F /* PSCAppDelegate.m */; }; 16 | 78CCD102168C5E4A00E09A4F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD101168C5E4A00E09A4F /* Default.png */; }; 17 | 78CCD104168C5E4A00E09A4F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD103168C5E4A00E09A4F /* Default@2x.png */; }; 18 | 78CCD106168C5E4A00E09A4F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD105168C5E4A00E09A4F /* Default-568h@2x.png */; }; 19 | 78CCD109168C5E4A00E09A4F /* PSCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CCD108168C5E4A00E09A4F /* PSCViewController.m */; }; 20 | 78CCD10C168C5E4A00E09A4F /* PSCViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD10A168C5E4A00E09A4F /* PSCViewController_iPhone.xib */; }; 21 | 78CCD10F168C5E4A00E09A4F /* PSCViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 78CCD10D168C5E4A00E09A4F /* PSCViewController_iPad.xib */; }; 22 | 78CCD11B168C5E5800E09A4F /* PSPDFActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CCD116168C5E5800E09A4F /* PSPDFActionSheet.m */; }; 23 | 78CCD11C168C5E5800E09A4F /* PSPDFAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CCD118168C5E5800E09A4F /* PSPDFAlertView.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 78CCD0EB168C5E4A00E09A4F /* PSAlertViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PSAlertViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 78CCD0EF168C5E4A00E09A4F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 29 | 78CCD0F1168C5E4A00E09A4F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 30 | 78CCD0F3168C5E4A00E09A4F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 31 | 78CCD0F7168C5E4A00E09A4F /* PSAlertViewExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PSAlertViewExample-Info.plist"; sourceTree = ""; }; 32 | 78CCD0F9168C5E4A00E09A4F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 33 | 78CCD0FB168C5E4A00E09A4F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 78CCD0FD168C5E4A00E09A4F /* PSAlertViewExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PSAlertViewExample-Prefix.pch"; sourceTree = ""; }; 35 | 78CCD0FE168C5E4A00E09A4F /* PSCAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PSCAppDelegate.h; sourceTree = ""; }; 36 | 78CCD0FF168C5E4A00E09A4F /* PSCAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PSCAppDelegate.m; sourceTree = ""; }; 37 | 78CCD101168C5E4A00E09A4F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 38 | 78CCD103168C5E4A00E09A4F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 39 | 78CCD105168C5E4A00E09A4F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 40 | 78CCD107168C5E4A00E09A4F /* PSCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PSCViewController.h; sourceTree = ""; }; 41 | 78CCD108168C5E4A00E09A4F /* PSCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PSCViewController.m; sourceTree = ""; }; 42 | 78CCD10B168C5E4A00E09A4F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/PSCViewController_iPhone.xib; sourceTree = ""; }; 43 | 78CCD10E168C5E4A00E09A4F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/PSCViewController_iPad.xib; sourceTree = ""; }; 44 | 78CCD115168C5E5800E09A4F /* PSPDFActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSPDFActionSheet.h; path = ../../PSPDFActionSheet.h; sourceTree = ""; }; 45 | 78CCD116168C5E5800E09A4F /* PSPDFActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSPDFActionSheet.m; path = ../../PSPDFActionSheet.m; sourceTree = ""; }; 46 | 78CCD117168C5E5800E09A4F /* PSPDFAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSPDFAlertView.h; path = ../../PSPDFAlertView.h; sourceTree = ""; }; 47 | 78CCD118168C5E5800E09A4F /* PSPDFAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSPDFAlertView.m; path = ../../PSPDFAlertView.m; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 78CCD0E8168C5E4A00E09A4F /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | 78CCD0F0168C5E4A00E09A4F /* UIKit.framework in Frameworks */, 56 | 78CCD0F2168C5E4A00E09A4F /* Foundation.framework in Frameworks */, 57 | 78CCD0F4168C5E4A00E09A4F /* CoreGraphics.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 78CCD0E0168C5E4A00E09A4F = { 65 | isa = PBXGroup; 66 | children = ( 67 | 78CCD0F5168C5E4A00E09A4F /* PSAlertViewExample */, 68 | 78CCD0EE168C5E4A00E09A4F /* Frameworks */, 69 | 78CCD0EC168C5E4A00E09A4F /* Products */, 70 | ); 71 | sourceTree = ""; 72 | }; 73 | 78CCD0EC168C5E4A00E09A4F /* Products */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 78CCD0EB168C5E4A00E09A4F /* PSAlertViewExample.app */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 78CCD0EE168C5E4A00E09A4F /* Frameworks */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 78CCD0EF168C5E4A00E09A4F /* UIKit.framework */, 85 | 78CCD0F1168C5E4A00E09A4F /* Foundation.framework */, 86 | 78CCD0F3168C5E4A00E09A4F /* CoreGraphics.framework */, 87 | ); 88 | name = Frameworks; 89 | sourceTree = ""; 90 | }; 91 | 78CCD0F5168C5E4A00E09A4F /* PSAlertViewExample */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 78CCD11E168C5E5B00E09A4F /* PSAlertView */, 95 | 78CCD0FE168C5E4A00E09A4F /* PSCAppDelegate.h */, 96 | 78CCD0FF168C5E4A00E09A4F /* PSCAppDelegate.m */, 97 | 78CCD107168C5E4A00E09A4F /* PSCViewController.h */, 98 | 78CCD108168C5E4A00E09A4F /* PSCViewController.m */, 99 | 78CCD10A168C5E4A00E09A4F /* PSCViewController_iPhone.xib */, 100 | 78CCD10D168C5E4A00E09A4F /* PSCViewController_iPad.xib */, 101 | 78CCD0F6168C5E4A00E09A4F /* Supporting Files */, 102 | ); 103 | path = PSAlertViewExample; 104 | sourceTree = ""; 105 | }; 106 | 78CCD0F6168C5E4A00E09A4F /* Supporting Files */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 78CCD0F7168C5E4A00E09A4F /* PSAlertViewExample-Info.plist */, 110 | 78CCD0F8168C5E4A00E09A4F /* InfoPlist.strings */, 111 | 78CCD0FB168C5E4A00E09A4F /* main.m */, 112 | 78CCD0FD168C5E4A00E09A4F /* PSAlertViewExample-Prefix.pch */, 113 | 78CCD101168C5E4A00E09A4F /* Default.png */, 114 | 78CCD103168C5E4A00E09A4F /* Default@2x.png */, 115 | 78CCD105168C5E4A00E09A4F /* Default-568h@2x.png */, 116 | ); 117 | name = "Supporting Files"; 118 | sourceTree = ""; 119 | }; 120 | 78CCD11E168C5E5B00E09A4F /* PSAlertView */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 78CCD115168C5E5800E09A4F /* PSPDFActionSheet.h */, 124 | 78CCD116168C5E5800E09A4F /* PSPDFActionSheet.m */, 125 | 78CCD117168C5E5800E09A4F /* PSPDFAlertView.h */, 126 | 78CCD118168C5E5800E09A4F /* PSPDFAlertView.m */, 127 | ); 128 | name = PSAlertView; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | 78CCD0EA168C5E4A00E09A4F /* PSAlertViewExample */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = 78CCD112168C5E4A00E09A4F /* Build configuration list for PBXNativeTarget "PSAlertViewExample" */; 137 | buildPhases = ( 138 | 78CCD0E7168C5E4A00E09A4F /* Sources */, 139 | 78CCD0E8168C5E4A00E09A4F /* Frameworks */, 140 | 78CCD0E9168C5E4A00E09A4F /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = PSAlertViewExample; 147 | productName = PSAlertViewExample; 148 | productReference = 78CCD0EB168C5E4A00E09A4F /* PSAlertViewExample.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | 78CCD0E2168C5E4A00E09A4F /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | CLASSPREFIX = PSC; 158 | LastUpgradeCheck = 0450; 159 | ORGANIZATIONNAME = PSPDFKit; 160 | }; 161 | buildConfigurationList = 78CCD0E5168C5E4A00E09A4F /* Build configuration list for PBXProject "PSAlertViewExample" */; 162 | compatibilityVersion = "Xcode 3.2"; 163 | developmentRegion = English; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | ); 168 | mainGroup = 78CCD0E0168C5E4A00E09A4F; 169 | productRefGroup = 78CCD0EC168C5E4A00E09A4F /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 78CCD0EA168C5E4A00E09A4F /* PSAlertViewExample */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 78CCD0E9168C5E4A00E09A4F /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 78CCD0FA168C5E4A00E09A4F /* InfoPlist.strings in Resources */, 184 | 78CCD102168C5E4A00E09A4F /* Default.png in Resources */, 185 | 78CCD104168C5E4A00E09A4F /* Default@2x.png in Resources */, 186 | 78CCD106168C5E4A00E09A4F /* Default-568h@2x.png in Resources */, 187 | 78CCD10C168C5E4A00E09A4F /* PSCViewController_iPhone.xib in Resources */, 188 | 78CCD10F168C5E4A00E09A4F /* PSCViewController_iPad.xib in Resources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXResourcesBuildPhase section */ 193 | 194 | /* Begin PBXSourcesBuildPhase section */ 195 | 78CCD0E7168C5E4A00E09A4F /* Sources */ = { 196 | isa = PBXSourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | 78CCD0FC168C5E4A00E09A4F /* main.m in Sources */, 200 | 78CCD100168C5E4A00E09A4F /* PSCAppDelegate.m in Sources */, 201 | 78CCD109168C5E4A00E09A4F /* PSCViewController.m in Sources */, 202 | 78CCD11B168C5E5800E09A4F /* PSPDFActionSheet.m in Sources */, 203 | 78CCD11C168C5E5800E09A4F /* PSPDFAlertView.m in Sources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin PBXVariantGroup section */ 210 | 78CCD0F8168C5E4A00E09A4F /* InfoPlist.strings */ = { 211 | isa = PBXVariantGroup; 212 | children = ( 213 | 78CCD0F9168C5E4A00E09A4F /* en */, 214 | ); 215 | name = InfoPlist.strings; 216 | sourceTree = ""; 217 | }; 218 | 78CCD10A168C5E4A00E09A4F /* PSCViewController_iPhone.xib */ = { 219 | isa = PBXVariantGroup; 220 | children = ( 221 | 78CCD10B168C5E4A00E09A4F /* en */, 222 | ); 223 | name = PSCViewController_iPhone.xib; 224 | sourceTree = ""; 225 | }; 226 | 78CCD10D168C5E4A00E09A4F /* PSCViewController_iPad.xib */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 78CCD10E168C5E4A00E09A4F /* en */, 230 | ); 231 | name = PSCViewController_iPad.xib; 232 | sourceTree = ""; 233 | }; 234 | /* End PBXVariantGroup section */ 235 | 236 | /* Begin XCBuildConfiguration section */ 237 | 78CCD110168C5E4A00E09A4F /* Debug */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 242 | CLANG_CXX_LIBRARY = "libc++"; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 246 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 247 | COPY_PHASE_STRIP = NO; 248 | GCC_C_LANGUAGE_STANDARD = gnu99; 249 | GCC_DYNAMIC_NO_PIC = NO; 250 | GCC_OPTIMIZATION_LEVEL = 0; 251 | GCC_PREPROCESSOR_DEFINITIONS = ( 252 | "DEBUG=1", 253 | "$(inherited)", 254 | ); 255 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 256 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 257 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 258 | GCC_WARN_UNUSED_VARIABLE = YES; 259 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 260 | ONLY_ACTIVE_ARCH = YES; 261 | SDKROOT = iphoneos; 262 | TARGETED_DEVICE_FAMILY = "1,2"; 263 | }; 264 | name = Debug; 265 | }; 266 | 78CCD111168C5E4A00E09A4F /* Release */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_OBJC_ARC = YES; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 275 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 276 | COPY_PHASE_STRIP = YES; 277 | GCC_C_LANGUAGE_STANDARD = gnu99; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 282 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 283 | SDKROOT = iphoneos; 284 | TARGETED_DEVICE_FAMILY = "1,2"; 285 | VALIDATE_PRODUCT = YES; 286 | }; 287 | name = Release; 288 | }; 289 | 78CCD113168C5E4A00E09A4F /* Debug */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 293 | GCC_PREFIX_HEADER = "PSAlertViewExample/PSAlertViewExample-Prefix.pch"; 294 | INFOPLIST_FILE = "PSAlertViewExample/PSAlertViewExample-Info.plist"; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | WRAPPER_EXTENSION = app; 297 | }; 298 | name = Debug; 299 | }; 300 | 78CCD114168C5E4A00E09A4F /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 304 | GCC_PREFIX_HEADER = "PSAlertViewExample/PSAlertViewExample-Prefix.pch"; 305 | INFOPLIST_FILE = "PSAlertViewExample/PSAlertViewExample-Info.plist"; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | WRAPPER_EXTENSION = app; 308 | }; 309 | name = Release; 310 | }; 311 | /* End XCBuildConfiguration section */ 312 | 313 | /* Begin XCConfigurationList section */ 314 | 78CCD0E5168C5E4A00E09A4F /* Build configuration list for PBXProject "PSAlertViewExample" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | 78CCD110168C5E4A00E09A4F /* Debug */, 318 | 78CCD111168C5E4A00E09A4F /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | 78CCD112168C5E4A00E09A4F /* Build configuration list for PBXNativeTarget "PSAlertViewExample" */ = { 324 | isa = XCConfigurationList; 325 | buildConfigurations = ( 326 | 78CCD113168C5E4A00E09A4F /* Debug */, 327 | 78CCD114168C5E4A00E09A4F /* Release */, 328 | ); 329 | defaultConfigurationIsVisible = 0; 330 | defaultConfigurationName = Release; 331 | }; 332 | /* End XCConfigurationList section */ 333 | }; 334 | rootObject = 78CCD0E2168C5E4A00E09A4F /* Project object */; 335 | } 336 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample.xcodeproj/project.xcworkspace/xcshareddata/PSAlertViewExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 68E34A12-5514-4585-93E2-BF838D95D0EF 9 | IDESourceControlProjectName 10 | PSAlertViewExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 377DF7E0-3324-49E3-AADC-3A10F726CC7A 14 | ssh://github.com/steipete/PSAlertView.git 15 | 16 | IDESourceControlProjectPath 17 | PSAlertViewExample/PSAlertViewExample.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 377DF7E0-3324-49E3-AADC-3A10F726CC7A 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/steipete/PSAlertView.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 377DF7E0-3324-49E3-AADC-3A10F726CC7A 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 377DF7E0-3324-49E3-AADC-3A10F726CC7A 36 | IDESourceControlWCCName 37 | PSAlertView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSAlertView/132f5436b5608c6f810330743abe13f29d5a71be/PSAlertViewExample/PSAlertViewExample/Default-568h@2x.png -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSAlertView/132f5436b5608c6f810330743abe13f29d5a71be/PSAlertViewExample/PSAlertViewExample/Default.png -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSAlertView/132f5436b5608c6f810330743abe13f29d5a71be/PSAlertViewExample/PSAlertViewExample/Default@2x.png -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSAlertViewExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.pspdfkit.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSAlertViewExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'PSAlertViewExample' target in the 'PSAlertViewExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSCAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSCAppDelegate.h 3 | // PSAlertViewExample 4 | // 5 | // Created by Peter Steinberger on 12/27/12. 6 | // Copyright (c) 2012 PSPDFKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class PSCViewController; 12 | 13 | @interface PSCAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) PSCViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSCAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSCAppDelegate.m 3 | // PSAlertViewExample 4 | // 5 | // Created by Peter Steinberger on 12/27/12. 6 | // Copyright (c) 2012 PSPDFKit. All rights reserved. 7 | // 8 | 9 | #import "PSCAppDelegate.h" 10 | 11 | #import "PSCViewController.h" 12 | 13 | @implementation PSCAppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | // Override point for customization after application launch. 19 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 20 | self.viewController = [[PSCViewController alloc] initWithNibName:@"PSCViewController_iPhone" bundle:nil]; 21 | } else { 22 | self.viewController = [[PSCViewController alloc] initWithNibName:@"PSCViewController_iPad" bundle:nil]; 23 | } 24 | self.window.rootViewController = self.viewController; 25 | [self.window makeKeyAndVisible]; 26 | return YES; 27 | } 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application 30 | { 31 | // 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. 32 | // 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. 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application 36 | { 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 | { 43 | // 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. 44 | } 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application 47 | { 48 | // 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. 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application 52 | { 53 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSCViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSCViewController.h 3 | // PSAlertViewExample 4 | // 5 | // Created by Peter Steinberger on 12/27/12. 6 | // Copyright (c) 2012 PSPDFKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PSCViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/PSCViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSCViewController.m 3 | // PSAlertViewExample 4 | // 5 | // Created by Peter Steinberger on 12/27/12. 6 | // Copyright (c) 2012 PSPDFKit. All rights reserved. 7 | // 8 | 9 | #import "PSCViewController.h" 10 | #import "PSPDFAlertView.h" 11 | #import 12 | 13 | // NOP here. 14 | #define PSPDFLocalize 15 | 16 | // Key to register alertViews to enable the return key. 17 | const char kPSPDFAlertViewKey; 18 | 19 | @interface PSCViewController () 20 | @end 21 | 22 | @implementation PSCViewController 23 | 24 | /////////////////////////////////////////////////////////////////////////////////////////// 25 | #pragma mark - UIViewController 26 | 27 | - (void)viewDidLoad { 28 | [super viewDidLoad]; 29 | 30 | UIButton *testButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 31 | [testButton setTitle:@"Show Alert" forState:UIControlStateNormal]; 32 | [testButton addTarget:self action:@selector(showAlertAction) forControlEvents:UIControlEventTouchUpInside]; 33 | [testButton sizeToFit]; 34 | testButton.center = self.view.center; 35 | [self.view addSubview:testButton]; 36 | } 37 | 38 | - (void)viewDidAppear:(BOOL)animated { 39 | [super viewDidAppear:animated]; 40 | [self showAlertAction]; 41 | } 42 | 43 | /////////////////////////////////////////////////////////////////////////////////////////// 44 | #pragma mark - Private 45 | 46 | - (void)showAlertAction { 47 | PSPDFAlertView *titlePrompt = [[PSPDFAlertView alloc] initWithTitle:PSPDFLocalize(@"Title") message:@"This is a test alert."]; 48 | titlePrompt.alertViewStyle = UIAlertViewStylePlainTextInput; 49 | 50 | [titlePrompt textFieldAtIndex:0].text = @"Preset Text"; 51 | [titlePrompt setCancelButtonWithTitle:PSPDFLocalize(@"Cancel") block:nil]; 52 | __weak PSPDFAlertView *weakAlertView = titlePrompt; 53 | [titlePrompt addButtonWithTitle:PSPDFLocalize(@"Save") block:^(NSInteger buttonIndex) { 54 | NSString *newSubject = [weakAlertView textFieldAtIndex:0].text ?: @""; 55 | NSLog(@"Entered text: %@", newSubject); 56 | }]; 57 | 58 | // add support for the return key 59 | [[titlePrompt textFieldAtIndex:0] setDelegate:self]; 60 | objc_setAssociatedObject([titlePrompt textFieldAtIndex:0], &kPSPDFAlertViewKey, titlePrompt, OBJC_ASSOCIATION_ASSIGN); 61 | 62 | [titlePrompt show]; 63 | } 64 | 65 | /////////////////////////////////////////////////////////////////////////////////////////// 66 | #pragma mark - UITextFieldDelegate 67 | 68 | // Enable the return key on the alert view. 69 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 70 | UIAlertView *alertView = objc_getAssociatedObject(textField, &kPSPDFAlertViewKey); 71 | if (alertView) { [alertView dismissWithClickedButtonIndex:1 animated:YES]; return YES; } 72 | else return NO; 73 | } 74 | @end 75 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/en.lproj/PSCViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12A206j 6 | 2519 7 | 1172.1 8 | 613.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1856 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBIPadFramework 28 | 29 | 30 | IBFirstResponder 31 | IBIPadFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {768, 1004}} 37 | 38 | 39 | 40 | 3 41 | MQA 42 | 43 | 2 44 | 45 | 46 | 47 | 2 48 | 49 | IBIPadFramework 50 | 51 | 52 | 53 | 54 | 55 | 56 | view 57 | 58 | 59 | 60 | 3 61 | 62 | 63 | 64 | 65 | 66 | 0 67 | 68 | 69 | 70 | 71 | 72 | -1 73 | 74 | 75 | File's Owner 76 | 77 | 78 | -2 79 | 80 | 81 | 82 | 83 | 2 84 | 85 | 86 | 87 | 88 | 89 | 90 | PSCViewController 91 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 92 | UIResponder 93 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 94 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 95 | 96 | 97 | 98 | 99 | 100 | 3 101 | 102 | 103 | 104 | 105 | PSCViewController 106 | UIViewController 107 | 108 | IBProjectSource 109 | ./Classes/PSCViewController.h 110 | 111 | 112 | 113 | 114 | 0 115 | IBIPadFramework 116 | YES 117 | 3 118 | YES 119 | 1856 120 | 121 | 122 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/en.lproj/PSCViewController_iPhone.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12A269 6 | 2835 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1919 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 548}} 37 | 38 | 39 | 40 | 41 | 3 42 | MC43NQA 43 | 44 | 2 45 | 46 | 47 | NO 48 | 49 | 50 | IBUIScreenMetrics 51 | 52 | YES 53 | 54 | 55 | 56 | 57 | 58 | {320, 568} 59 | {568, 320} 60 | 61 | 62 | IBCocoaTouchFramework 63 | Retina 4 Full Screen 64 | 2 65 | 66 | IBCocoaTouchFramework 67 | 68 | 69 | 70 | 71 | 72 | 73 | view 74 | 75 | 76 | 77 | 7 78 | 79 | 80 | 81 | 82 | 83 | 0 84 | 85 | 86 | 87 | 88 | 89 | -1 90 | 91 | 92 | File's Owner 93 | 94 | 95 | -2 96 | 97 | 98 | 99 | 100 | 6 101 | 102 | 103 | 104 | 105 | 106 | 107 | PSCViewController 108 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 109 | UIResponder 110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 111 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 | 113 | 114 | 115 | 116 | 117 | 7 118 | 119 | 120 | 121 | 122 | PSCViewController 123 | UIViewController 124 | 125 | IBProjectSource 126 | ./Classes/PSCViewController.h 127 | 128 | 129 | 130 | 131 | 0 132 | IBCocoaTouchFramework 133 | YES 134 | 3 135 | YES 136 | 1919 137 | 138 | 139 | -------------------------------------------------------------------------------- /PSAlertViewExample/PSAlertViewExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PSAlertViewExample 4 | // 5 | // Created by Peter Steinberger on 12/27/12. 6 | // Copyright (c) 2012 PSPDFKit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "PSCAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([PSCAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PSPDFActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSPDFActionSheet.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2014 PSPDFKit GmbH. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | /// Helper to add block features to `UIActionSheet`. 11 | /// After block has been executed, it is set to nil, breaking potential retain cycles. 12 | @interface PSPDFActionSheet : UIActionSheet 13 | 14 | /// @name Initialization 15 | 16 | /// Default initializer. 17 | - (id)initWithTitle:(NSString *)title; 18 | 19 | /// @name Adding Buttons 20 | 21 | /// Adds a cancel button. Use only once. 22 | - (void)setCancelButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block; 23 | 24 | /// Adds a destructive button. Use only once. 25 | - (void)setDestructiveButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block; 26 | 27 | /// Add regular button. 28 | - (void)addButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block; 29 | 30 | /// @name Properties and show/destroy 31 | 32 | /// Count the buttons. 33 | - (NSUInteger)buttonCount; 34 | 35 | /// Is clever about the sender, uses fallbackView if sender is not usable (nil, or not `UIBarButtonItem`/`UIView`) 36 | - (void)showWithSender:(id)sender fallbackView:(UIView *)view animated:(BOOL)animated; 37 | 38 | /// A `UIActionSheet` can always be cancelled, even if no cancel button is present. 39 | /// Use `allowsTapToDismiss` to block cancellation on tap. The control might still be cancelled from OS events. 40 | - (void)addCancelBlock:(void (^)(NSInteger buttonIndex))cancelBlock; 41 | 42 | /// Add block that is called after the sheet will be dismissed (before animation). 43 | /// @note In difference to the action sheet, this is called BEFORE any of the block-based button actions are called. 44 | - (void)addWillDismissBlock:(void (^)(NSInteger buttonIndex))willDismissBlock; 45 | 46 | /// Add block that is called after the sheet has been dismissed (after animation). 47 | - (void)addDidDismissBlock:(void (^)(NSInteger buttonIndex))didDismissBlock; 48 | 49 | /// Allows to be dismissed by tapping outside? Defaults to YES (UIActionSheet default) 50 | @property (nonatomic, assign) BOOL allowsTapToDismiss; 51 | 52 | @end 53 | 54 | @interface PSPDFActionSheet (PSPDFSuperclassBlock) 55 | 56 | - (id)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... __attribute__((unavailable("Please use initWithTitle:"))); 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /PSPDFActionSheet.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSPDFActionSheet.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2014 PSPDFKit GmbH. All rights reserved. 6 | // 7 | 8 | #import "PSPDFActionSheet.h" 9 | #import 10 | 11 | @interface PSPDFActionSheet () 12 | @property (nonatomic, assign, getter=isDismissing) BOOL dismissing; 13 | @property (nonatomic, copy) NSArray *blocks; 14 | @property (nonatomic, copy) NSArray *cancelBlocks; 15 | @property (nonatomic, copy) NSArray *willDismissBlocks; 16 | @property (nonatomic, copy) NSArray *didDismissBlocks; 17 | @property (nonatomic, weak) id realDelegate; 18 | @end 19 | 20 | @implementation PSPDFActionSheet 21 | 22 | /////////////////////////////////////////////////////////////////////////////////////////// 23 | #pragma mark - NSObject 24 | 25 | - (id)init { 26 | if ((self = [super init])) { 27 | _allowsTapToDismiss = YES; 28 | [super setDelegate:self]; 29 | } 30 | return self; 31 | } 32 | 33 | - (id)initWithTitle:(NSString *)title { 34 | return self = [super initWithTitle:title delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 35 | } 36 | 37 | - (void)dealloc { 38 | self.delegate = nil; 39 | } 40 | 41 | - (NSString *)description { 42 | return [NSString stringWithFormat:@"<%@: %p numberOfButtons:%zd title:%@>", self.class, self, self.numberOfButtons, self.title]; 43 | } 44 | 45 | /////////////////////////////////////////////////////////////////////////////////////////// 46 | #pragma mark - Public 47 | 48 | - (void)setDelegate:(id)delegate { 49 | [super setDelegate:delegate ? self : nil]; 50 | self.realDelegate = delegate != self ? delegate : nil; 51 | } 52 | 53 | - (void)setDestructiveButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block { 54 | [self addButtonWithTitle:title block:block]; 55 | self.destructiveButtonIndex = self.numberOfButtons - 1; 56 | } 57 | 58 | - (void)setCancelButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block { 59 | [self addButtonWithTitle:title block:block]; 60 | self.cancelButtonIndex = self.numberOfButtons - 1; 61 | } 62 | 63 | - (void)addButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block { 64 | NSParameterAssert(title); 65 | self.blocks = [[NSArray arrayWithArray:self.blocks] arrayByAddingObject:block ? [block copy] : NSNull.null]; 66 | [self addButtonWithTitle:title]; 67 | } 68 | 69 | - (NSUInteger)buttonCount { 70 | return self.blocks.count; 71 | } 72 | 73 | - (void)showWithSender:(id)sender fallbackView:(UIView *)view animated:(BOOL)animated { 74 | BOOL isIPad = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad; 75 | if (isIPad && [sender isKindOfClass:UIBarButtonItem.class]) { 76 | [self showFromBarButtonItem:sender animated:animated]; 77 | }else if ([sender isKindOfClass:UIToolbar.class]) { 78 | [self showFromToolbar:sender]; 79 | }else if ([sender isKindOfClass:UITabBar.class]) { 80 | [self showFromTabBar:sender]; 81 | }else if ([view isKindOfClass:UIToolbar.class]) { 82 | [self showFromToolbar:(UIToolbar *)view]; 83 | }else if ([view isKindOfClass:UITabBar.class]) { 84 | [self showFromTabBar:(UITabBar *)view]; 85 | }else if (isIPad && [sender isKindOfClass:UIView.class]) { 86 | [self showFromRect:[sender bounds] inView:sender animated:animated]; 87 | }else if ([sender isKindOfClass:NSValue.class]) { 88 | [self showFromRect:[sender CGRectValue] inView:view animated:animated]; 89 | }else { 90 | [self showInView:view]; 91 | } 92 | } 93 | 94 | - (void)destroy { 95 | self.blocks = nil; 96 | self.cancelBlocks = nil; 97 | self.willDismissBlocks = nil; 98 | self.didDismissBlocks = nil; 99 | self.delegate = nil; 100 | } 101 | 102 | - (void)addCancelBlock:(void (^)(NSInteger buttonIndex))cancelBlock { 103 | NSParameterAssert(cancelBlock); 104 | self.cancelBlocks = [[NSArray arrayWithArray:self.cancelBlocks] arrayByAddingObject:cancelBlock]; 105 | } 106 | 107 | - (void)addWillDismissBlock:(void (^)(NSInteger buttonIndex))willDismissBlock { 108 | NSParameterAssert(willDismissBlock); 109 | self.willDismissBlocks = [[NSArray arrayWithArray:self.willDismissBlocks] arrayByAddingObject:willDismissBlock]; 110 | } 111 | 112 | - (void)addDidDismissBlock:(void (^)(NSInteger buttonIndex))didDismissBlock { 113 | NSParameterAssert(didDismissBlock); 114 | self.didDismissBlocks = [[NSArray arrayWithArray:self.didDismissBlocks] arrayByAddingObject:didDismissBlock]; 115 | } 116 | 117 | - (void)_callBlocks:(NSArray *)blocks withButtonIndex:(NSInteger)buttonIndex { 118 | for (void (^block)(NSInteger buttonIndex) in blocks) { 119 | block(buttonIndex); 120 | } 121 | } 122 | 123 | /////////////////////////////////////////////////////////////////////////////////////////// 124 | #pragma mark - UIActionSheet 125 | 126 | - (void)showInView:(UIView *)view { 127 | if (view.window || [view isKindOfClass:[UIWindow class]]) { 128 | [super showInView:view]; 129 | }else { 130 | NSLog(@"Ignoring call since view has no window."); 131 | } 132 | } 133 | 134 | /////////////////////////////////////////////////////////////////////////////////////////// 135 | #pragma mark - UIActionSheetDelegate 136 | 137 | // Called when a button is clicked. The view will be automatically dismissed after this call returns. 138 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 139 | // We want any of the will dismiss blocks to be called before the action blocks. 140 | [self _callBlocks:self.willDismissBlocks withButtonIndex:buttonIndex]; 141 | self.willDismissBlocks = nil; 142 | 143 | // Find the matching action block.` 144 | if (buttonIndex >= 0 && buttonIndex < self.blocks.count) { 145 | void (^block)(NSUInteger) = self.blocks[buttonIndex]; 146 | if (![block isEqual:NSNull.null]) { 147 | block(buttonIndex); 148 | } 149 | } 150 | 151 | // Call cancel blocks. This is -1 if no cancel button is available. 152 | if (buttonIndex == self.cancelButtonIndex) { 153 | [self _callBlocks:self.cancelBlocks withButtonIndex:buttonIndex]; 154 | } 155 | 156 | // Forward to real delegate. 157 | id delegate = self.realDelegate; 158 | if ([delegate respondsToSelector:_cmd]) { 159 | [delegate actionSheet:actionSheet clickedButtonAtIndex:buttonIndex]; 160 | } 161 | } 162 | 163 | // Before animation and hiding view. 164 | - (void)willPresentActionSheet:(UIActionSheet *)actionSheet { 165 | id delegate = self.realDelegate; 166 | if ([delegate respondsToSelector:_cmd]) { 167 | [delegate willPresentActionSheet:actionSheet]; 168 | } 169 | } 170 | 171 | - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated { 172 | [super dismissWithClickedButtonIndex:buttonIndex animated:animated]; 173 | 174 | // In iOS 8, this method is being called even when we dismissed based on a button action. 175 | // It's not called on iOS 7 or earlier. We track if it's a user-initiated or programmatic 176 | // dismissal via `isDismissingAlertView`. 177 | if (!self.isDismissing) { 178 | [self actionSheet:self clickedButtonAtIndex:buttonIndex]; 179 | } 180 | } 181 | 182 | - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex { 183 | self.dismissing = YES; 184 | [self _callBlocks:self.willDismissBlocks withButtonIndex:buttonIndex]; 185 | self.willDismissBlocks = nil; 186 | 187 | id delegate = self.realDelegate; 188 | if ([delegate respondsToSelector:_cmd]) { 189 | [delegate actionSheet:actionSheet willDismissWithButtonIndex:buttonIndex]; 190 | } 191 | } 192 | 193 | // After animation. 194 | - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { 195 | [self _callBlocks:self.didDismissBlocks withButtonIndex:buttonIndex]; 196 | 197 | id delegate = self.realDelegate; 198 | if ([delegate respondsToSelector:_cmd]) { 199 | [delegate actionSheet:actionSheet didDismissWithButtonIndex:buttonIndex]; 200 | } 201 | self.dismissing = NO; 202 | } 203 | 204 | /////////////////////////////////////////////////////////////////////////////////////////// 205 | #pragma mark - UIPopoverController 206 | 207 | - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController { 208 | return self.allowsTapToDismiss; 209 | } 210 | 211 | /////////////////////////////////////////////////////////////////////////////////////////// 212 | #pragma mark - Delegate Forwarder 213 | 214 | - (BOOL)respondsToSelector:(SEL)s { 215 | return [super respondsToSelector:s] || [self.realDelegate respondsToSelector:s]; 216 | } 217 | 218 | - (id)forwardingTargetForSelector:(SEL)s { 219 | id delegate = self.realDelegate; 220 | return [delegate respondsToSelector:s] ? delegate : [super forwardingTargetForSelector:s]; 221 | } 222 | 223 | @end 224 | -------------------------------------------------------------------------------- /PSPDFAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSPDFAlertView.h 3 | // 4 | // Copyright (c) 2011-2014 PSPDFKit GmbH. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | /// Helper to add block features to `UIAlertView`. 10 | /// @note After block has been executed, it is set to nil, breaking potential retain cycles. 11 | @interface PSPDFAlertView : UIAlertView 12 | 13 | /// @name Initialization 14 | 15 | /// Default initializer. 16 | - (id)initWithTitle:(NSString *)title; 17 | - (id)initWithTitle:(NSString *)title message:(NSString *)message; 18 | 19 | /// @name Adding Buttons 20 | 21 | /// Add a cancel button. (use only once!) 22 | - (NSInteger)setCancelButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block; 23 | 24 | /// Add regular button. 25 | - (NSInteger)addButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block; 26 | 27 | /// Add block that is called after the alert view will be dismissed (before animation). 28 | - (void)addWillDismissBlock:(void (^)(NSInteger buttonIndex))willDismissBlock; 29 | 30 | /// Add block that is called after the alert view has been dismissed (after animation). 31 | - (void)addDidDismissBlock:(void (^)(NSInteger buttonIndex))didDismissBlock; 32 | 33 | @end 34 | 35 | @interface PSPDFAlertView (PSPDFSuperclassBlock) 36 | 37 | - (id)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... __attribute__((unavailable("Please use initWithTitle:"))); 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PSPDFAlertView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSPDFAlertView.m 3 | // 4 | // Copyright (c) 2011-2014 PSPDFKit GmbH. All rights reserved. 5 | // 6 | 7 | #import "PSPDFAlertView.h" 8 | 9 | @interface PSPDFAlertView () 10 | @property (nonatomic, assign, getter=isDismissing) BOOL dismissing; 11 | @property (nonatomic, copy) NSArray *blocks; 12 | @property (nonatomic, copy) NSArray *willDismissBlocks; 13 | @property (nonatomic, copy) NSArray *didDismissBlocks; 14 | @property (nonatomic, weak) id realDelegate; 15 | @end 16 | 17 | @implementation PSPDFAlertView 18 | 19 | /////////////////////////////////////////////////////////////////////////////////////////// 20 | #pragma mark - NSObject 21 | 22 | - (id)init { 23 | if (self = [super init]) { 24 | [super setDelegate:self]; 25 | } 26 | return self; 27 | } 28 | 29 | - (id)initWithTitle:(NSString *)title { 30 | return self = [self initWithTitle:title message:nil]; 31 | } 32 | 33 | - (id)initWithTitle:(NSString *)title message:(NSString *)message { 34 | return self = [super initWithTitle:title message:message delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; 35 | } 36 | 37 | - (void)dealloc { 38 | self.delegate = nil; 39 | } 40 | 41 | - (NSString *)description { 42 | return [NSString stringWithFormat:@"<%@: %p numberOfButtons:%zd title:%@>", NSStringFromClass(self.class), self, self.numberOfButtons, self.title]; 43 | } 44 | 45 | - (void)destroy { 46 | self.blocks = nil; 47 | self.willDismissBlocks = nil; 48 | self.didDismissBlocks = nil; 49 | self.delegate = nil; 50 | } 51 | 52 | /////////////////////////////////////////////////////////////////////////////////////////// 53 | #pragma mark - Public 54 | 55 | - (void)setDelegate:(id/***/)delegate { 56 | [super setDelegate:delegate ? self : nil]; 57 | self.realDelegate = delegate != self ? delegate : nil; 58 | } 59 | 60 | - (NSInteger)setCancelButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block { 61 | NSUInteger buttonIndex = [self addButtonWithTitle:title block:block]; 62 | self.cancelButtonIndex = buttonIndex; 63 | return buttonIndex; 64 | } 65 | 66 | - (NSInteger)addButtonWithTitle:(NSString *)title block:(void (^)(NSInteger buttonIndex))block { 67 | NSParameterAssert(title); 68 | self.blocks = [[NSArray arrayWithArray:self.blocks] arrayByAddingObject:block ? [block copy] : NSNull.null]; 69 | return [self addButtonWithTitle:title]; 70 | } 71 | 72 | - (NSInteger)addButtonWithTitle:(NSString *)title { 73 | NSInteger buttonIndex = [super addButtonWithTitle:title]; 74 | 75 | // Ensure blocks array is equal to number of buttons. 76 | while (self.blocks.count < self.numberOfButtons) { 77 | self.blocks = [[NSArray arrayWithArray:self.blocks] arrayByAddingObject:NSNull.null]; 78 | } 79 | 80 | return buttonIndex; 81 | } 82 | 83 | - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated { 84 | [super dismissWithClickedButtonIndex:buttonIndex animated:animated]; 85 | 86 | // In iOS 8, this method is being called even when we dismissed based on a button action. 87 | // It's not called on iOS 7 or earlier. We track if it's a user-initiated or programmatic 88 | // dismissal via `isDismissing`. 89 | if (!self.isDismissing) { 90 | [self alertView:self clickedButtonAtIndex:buttonIndex]; 91 | } 92 | } 93 | 94 | - (void)addWillDismissBlock:(void (^)(NSInteger buttonIndex))willDismissBlock { 95 | NSParameterAssert(willDismissBlock); 96 | self.willDismissBlocks = [[NSArray arrayWithArray:self.willDismissBlocks] arrayByAddingObject:willDismissBlock]; 97 | } 98 | 99 | - (void)addDidDismissBlock:(void (^)(NSInteger buttonIndex))didDismissBlock { 100 | NSParameterAssert(didDismissBlock); 101 | self.didDismissBlocks = [[NSArray arrayWithArray:self.didDismissBlocks] arrayByAddingObject:didDismissBlock]; 102 | } 103 | 104 | - (void)_callBlocks:(NSArray *)blocks withButtonIndex:(NSInteger)buttonIndex { 105 | for (void (^block)(NSInteger buttonIndex) in blocks) { 106 | block(buttonIndex); 107 | } 108 | } 109 | 110 | /////////////////////////////////////////////////////////////////////////////////////////// 111 | #pragma mark - UIAlertViewDelegate 112 | 113 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { 114 | // Run the button's block. 115 | if (buttonIndex >= 0 && buttonIndex < self.blocks.count) { 116 | void (^block)(NSUInteger) = self.blocks[buttonIndex]; 117 | if (![block isEqual:NSNull.null]) { 118 | block(buttonIndex); 119 | } 120 | } 121 | 122 | id delegate = self.realDelegate; 123 | if ([delegate respondsToSelector:_cmd]) { 124 | [delegate alertView:alertView clickedButtonAtIndex:buttonIndex]; 125 | } 126 | } 127 | 128 | - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex { 129 | self.dismissing = YES; 130 | [self _callBlocks:self.willDismissBlocks withButtonIndex:buttonIndex]; 131 | 132 | id delegate = self.realDelegate; 133 | if ([delegate respondsToSelector:_cmd]) { 134 | [delegate alertView:alertView willDismissWithButtonIndex:buttonIndex]; 135 | } 136 | } 137 | 138 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { 139 | [self _callBlocks:self.didDismissBlocks withButtonIndex:buttonIndex]; 140 | 141 | id delegate = self.realDelegate; 142 | if ([delegate respondsToSelector:_cmd]) { 143 | [delegate alertView:alertView didDismissWithButtonIndex:buttonIndex]; 144 | } 145 | 146 | [self destroy]; 147 | self.dismissing = NO; 148 | } 149 | 150 | /////////////////////////////////////////////////////////////////////////////////////////// 151 | #pragma mark - Delegate Forwarder 152 | 153 | - (BOOL)respondsToSelector:(SEL)s { 154 | return [super respondsToSelector:s] || [self.realDelegate respondsToSelector:s]; 155 | } 156 | 157 | - (id)forwardingTargetForSelector:(SEL)s { 158 | id delegate = self.realDelegate; 159 | return [delegate respondsToSelector:s] ? delegate : [super forwardingTargetForSelector:s]; 160 | } 161 | 162 | @end 163 | -------------------------------------------------------------------------------- /PSPDFAlertView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9225C6A91848804300B41E32 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9225C6A81848804300B41E32 /* Foundation.framework */; }; 11 | 9225C6D41848806E00B41E32 /* PSPDFActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6CF1848806E00B41E32 /* PSPDFActionSheet.m */; }; 12 | 9225C6D51848806E00B41E32 /* PSPDFAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6D11848806E00B41E32 /* PSPDFAlertView.m */; }; 13 | 9225C6D61848806E00B41E32 /* UIColor+PSPDFKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6D31848806E00B41E32 /* UIColor+PSPDFKitAdditions.m */; }; 14 | 9225C6D81848809400B41E32 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9225C6D71848809400B41E32 /* UIKit.framework */; }; 15 | 9225C6DB184880E000B41E32 /* UIColor+PSPDFKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6D31848806E00B41E32 /* UIColor+PSPDFKitAdditions.m */; }; 16 | 9225C6DC184880E000B41E32 /* PSPDFActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6CF1848806E00B41E32 /* PSPDFActionSheet.m */; }; 17 | 9225C6DD184880E000B41E32 /* PSPDFAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9225C6D11848806E00B41E32 /* PSPDFAlertView.m */; }; 18 | 9225C6DF184880E000B41E32 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9225C6D71848809400B41E32 /* UIKit.framework */; }; 19 | 9225C6E0184880E000B41E32 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9225C6A81848804300B41E32 /* Foundation.framework */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 9225C6A31848804300B41E32 /* CopyFiles */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = "include/$(PRODUCT_NAME)"; 27 | dstSubfolderSpec = 16; 28 | files = ( 29 | ); 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | 9225C6E1184880E000B41E32 /* CopyFiles */ = { 33 | isa = PBXCopyFilesBuildPhase; 34 | buildActionMask = 2147483647; 35 | dstPath = "include/$(PRODUCT_NAME)"; 36 | dstSubfolderSpec = 16; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXCopyFilesBuildPhase section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 9225C6A51848804300B41E32 /* libPSPDFAlertView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPSPDFAlertView.a; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 9225C6A81848804300B41E32 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 46 | 9225C6B61848804300B41E32 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 47 | 9225C6B91848804300B41E32 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 48 | 9225C6CE1848806E00B41E32 /* PSPDFActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSPDFActionSheet.h; sourceTree = SOURCE_ROOT; }; 49 | 9225C6CF1848806E00B41E32 /* PSPDFActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSPDFActionSheet.m; sourceTree = SOURCE_ROOT; }; 50 | 9225C6D01848806E00B41E32 /* PSPDFAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSPDFAlertView.h; sourceTree = SOURCE_ROOT; }; 51 | 9225C6D11848806E00B41E32 /* PSPDFAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSPDFAlertView.m; sourceTree = SOURCE_ROOT; }; 52 | 9225C6D21848806E00B41E32 /* UIColor+PSPDFKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+PSPDFKitAdditions.h"; sourceTree = SOURCE_ROOT; }; 53 | 9225C6D31848806E00B41E32 /* UIColor+PSPDFKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+PSPDFKitAdditions.m"; sourceTree = SOURCE_ROOT; }; 54 | 9225C6D71848809400B41E32 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 55 | 9225C6E5184880E000B41E32 /* libPSPDFAlertView+arm64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPSPDFAlertView+arm64.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 9225C6A21848804300B41E32 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9225C6D81848809400B41E32 /* UIKit.framework in Frameworks */, 64 | 9225C6A91848804300B41E32 /* Foundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 9225C6DE184880E000B41E32 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | 9225C6DF184880E000B41E32 /* UIKit.framework in Frameworks */, 73 | 9225C6E0184880E000B41E32 /* Foundation.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | /* End PBXFrameworksBuildPhase section */ 78 | 79 | /* Begin PBXGroup section */ 80 | 9225C69C1848804300B41E32 = { 81 | isa = PBXGroup; 82 | children = ( 83 | 9225C6AA1848804300B41E32 /* Code */, 84 | 9225C6A71848804300B41E32 /* Frameworks */, 85 | 9225C6A61848804300B41E32 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 9225C6A61848804300B41E32 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 9225C6A51848804300B41E32 /* libPSPDFAlertView.a */, 93 | 9225C6E5184880E000B41E32 /* libPSPDFAlertView+arm64.a */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 9225C6A71848804300B41E32 /* Frameworks */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 9225C6D71848809400B41E32 /* UIKit.framework */, 102 | 9225C6A81848804300B41E32 /* Foundation.framework */, 103 | 9225C6B61848804300B41E32 /* XCTest.framework */, 104 | 9225C6B91848804300B41E32 /* UIKit.framework */, 105 | ); 106 | name = Frameworks; 107 | sourceTree = ""; 108 | }; 109 | 9225C6AA1848804300B41E32 /* Code */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 9225C6CE1848806E00B41E32 /* PSPDFActionSheet.h */, 113 | 9225C6CF1848806E00B41E32 /* PSPDFActionSheet.m */, 114 | 9225C6D01848806E00B41E32 /* PSPDFAlertView.h */, 115 | 9225C6D11848806E00B41E32 /* PSPDFAlertView.m */, 116 | 9225C6D21848806E00B41E32 /* UIColor+PSPDFKitAdditions.h */, 117 | 9225C6D31848806E00B41E32 /* UIColor+PSPDFKitAdditions.m */, 118 | ); 119 | name = Code; 120 | path = PSPDFAlertView; 121 | sourceTree = ""; 122 | }; 123 | /* End PBXGroup section */ 124 | 125 | /* Begin PBXNativeTarget section */ 126 | 9225C6A41848804300B41E32 /* PSPDFAlertView */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = 9225C6C81848804300B41E32 /* Build configuration list for PBXNativeTarget "PSPDFAlertView" */; 129 | buildPhases = ( 130 | 9225C6A11848804300B41E32 /* Sources */, 131 | 9225C6A21848804300B41E32 /* Frameworks */, 132 | 9225C6A31848804300B41E32 /* CopyFiles */, 133 | ); 134 | buildRules = ( 135 | ); 136 | dependencies = ( 137 | ); 138 | name = PSPDFAlertView; 139 | productName = PSPDFAlertView; 140 | productReference = 9225C6A51848804300B41E32 /* libPSPDFAlertView.a */; 141 | productType = "com.apple.product-type.library.static"; 142 | }; 143 | 9225C6D9184880E000B41E32 /* PSPDFAlertView+arm64 */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = 9225C6E2184880E000B41E32 /* Build configuration list for PBXNativeTarget "PSPDFAlertView+arm64" */; 146 | buildPhases = ( 147 | 9225C6DA184880E000B41E32 /* Sources */, 148 | 9225C6DE184880E000B41E32 /* Frameworks */, 149 | 9225C6E1184880E000B41E32 /* CopyFiles */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = "PSPDFAlertView+arm64"; 156 | productName = PSPDFAlertView; 157 | productReference = 9225C6E5184880E000B41E32 /* libPSPDFAlertView+arm64.a */; 158 | productType = "com.apple.product-type.library.static"; 159 | }; 160 | /* End PBXNativeTarget section */ 161 | 162 | /* Begin PBXProject section */ 163 | 9225C69D1848804300B41E32 /* Project object */ = { 164 | isa = PBXProject; 165 | attributes = { 166 | LastUpgradeCheck = 0500; 167 | }; 168 | buildConfigurationList = 9225C6A01848804300B41E32 /* Build configuration list for PBXProject "PSPDFAlertView" */; 169 | compatibilityVersion = "Xcode 3.2"; 170 | developmentRegion = English; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | ); 175 | mainGroup = 9225C69C1848804300B41E32; 176 | productRefGroup = 9225C6A61848804300B41E32 /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 9225C6A41848804300B41E32 /* PSPDFAlertView */, 181 | 9225C6D9184880E000B41E32 /* PSPDFAlertView+arm64 */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXSourcesBuildPhase section */ 187 | 9225C6A11848804300B41E32 /* Sources */ = { 188 | isa = PBXSourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 9225C6D61848806E00B41E32 /* UIColor+PSPDFKitAdditions.m in Sources */, 192 | 9225C6D41848806E00B41E32 /* PSPDFActionSheet.m in Sources */, 193 | 9225C6D51848806E00B41E32 /* PSPDFAlertView.m in Sources */, 194 | ); 195 | runOnlyForDeploymentPostprocessing = 0; 196 | }; 197 | 9225C6DA184880E000B41E32 /* Sources */ = { 198 | isa = PBXSourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 9225C6DB184880E000B41E32 /* UIColor+PSPDFKitAdditions.m in Sources */, 202 | 9225C6DC184880E000B41E32 /* PSPDFActionSheet.m in Sources */, 203 | 9225C6DD184880E000B41E32 /* PSPDFAlertView.m in Sources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin XCBuildConfiguration section */ 210 | 9225C6C61848804300B41E32 /* Debug */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 215 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 216 | CLANG_CXX_LIBRARY = "libc++"; 217 | CLANG_ENABLE_MODULES = YES; 218 | CLANG_ENABLE_OBJC_ARC = YES; 219 | CLANG_WARN_BOOL_CONVERSION = YES; 220 | CLANG_WARN_CONSTANT_CONVERSION = YES; 221 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 222 | CLANG_WARN_EMPTY_BODY = YES; 223 | CLANG_WARN_ENUM_CONVERSION = YES; 224 | CLANG_WARN_INT_CONVERSION = YES; 225 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | COPY_PHASE_STRIP = NO; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_DYNAMIC_NO_PIC = NO; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_UNDECLARED_SELECTOR = YES; 239 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 240 | GCC_WARN_UNUSED_FUNCTION = YES; 241 | GCC_WARN_UNUSED_VARIABLE = YES; 242 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 243 | SDKROOT = iphoneos; 244 | }; 245 | name = Debug; 246 | }; 247 | 9225C6C71848804300B41E32 /* Release */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 252 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 253 | CLANG_CXX_LIBRARY = "libc++"; 254 | CLANG_ENABLE_MODULES = YES; 255 | CLANG_ENABLE_OBJC_ARC = YES; 256 | CLANG_WARN_BOOL_CONVERSION = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | COPY_PHASE_STRIP = YES; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | GCC_C_LANGUAGE_STANDARD = gnu99; 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 274 | SDKROOT = iphoneos; 275 | VALIDATE_PRODUCT = YES; 276 | }; 277 | name = Release; 278 | }; 279 | 9225C6C91848804300B41E32 /* Debug */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ARCHS = "$(ARCHS_STANDARD)"; 283 | DSTROOT = /tmp/PSPDFAlertView.dst; 284 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 285 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 286 | OTHER_LDFLAGS = "-ObjC"; 287 | PRODUCT_NAME = "$(TARGET_NAME)"; 288 | SKIP_INSTALL = YES; 289 | }; 290 | name = Debug; 291 | }; 292 | 9225C6CA1848804300B41E32 /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ARCHS = "$(ARCHS_STANDARD)"; 296 | DSTROOT = /tmp/PSPDFAlertView.dst; 297 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 299 | OTHER_LDFLAGS = "-ObjC"; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | SKIP_INSTALL = YES; 302 | }; 303 | name = Release; 304 | }; 305 | 9225C6E3184880E000B41E32 /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 309 | DSTROOT = /tmp/PSPDFAlertView.dst; 310 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 311 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 312 | OTHER_LDFLAGS = "-ObjC"; 313 | PRODUCT_NAME = "PSPDFAlertView+arm64"; 314 | SKIP_INSTALL = YES; 315 | }; 316 | name = Debug; 317 | }; 318 | 9225C6E4184880E000B41E32 /* Release */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 322 | DSTROOT = /tmp/PSPDFAlertView.dst; 323 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 325 | OTHER_LDFLAGS = "-ObjC"; 326 | PRODUCT_NAME = "PSPDFAlertView+arm64"; 327 | SKIP_INSTALL = YES; 328 | }; 329 | name = Release; 330 | }; 331 | /* End XCBuildConfiguration section */ 332 | 333 | /* Begin XCConfigurationList section */ 334 | 9225C6A01848804300B41E32 /* Build configuration list for PBXProject "PSPDFAlertView" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | 9225C6C61848804300B41E32 /* Debug */, 338 | 9225C6C71848804300B41E32 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | 9225C6C81848804300B41E32 /* Build configuration list for PBXNativeTarget "PSPDFAlertView" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | 9225C6C91848804300B41E32 /* Debug */, 347 | 9225C6CA1848804300B41E32 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | 9225C6E2184880E000B41E32 /* Build configuration list for PBXNativeTarget "PSPDFAlertView+arm64" */ = { 353 | isa = XCConfigurationList; 354 | buildConfigurations = ( 355 | 9225C6E3184880E000B41E32 /* Debug */, 356 | 9225C6E4184880E000B41E32 /* Release */, 357 | ); 358 | defaultConfigurationIsVisible = 0; 359 | defaultConfigurationName = Release; 360 | }; 361 | /* End XCConfigurationList section */ 362 | }; 363 | rootObject = 9225C69D1848804300B41E32 /* Project object */; 364 | } 365 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PSAlertView & PSActionSheet 2 | ============= 3 | 4 | Update: Look into the more modern [PSTAlertController](https://github.com/steipete/PSTAlertController) instead. 5 | 6 | Block-based subclasses for UIActionSheet and UIAlertView, extracted from the commercial [PSPDFKit PDF framework](http://PSPDFKit.com), because I love open source. 7 | 8 | PSAlertView uses ARC and is tested with Xcode 5.1.1 (iOS 6.0+) 9 | 10 | ## Creator 11 | 12 | [Peter Steinberger](http://github.com/steipete) 13 | [@steipete](https://twitter.com/steipete) 14 | 15 | I'd love a thank you tweet if you find this useful. 16 | 17 | ## License 18 | 19 | PSAlertView is available under the MIT license. See the LICENSE file for more info. 20 | --------------------------------------------------------------------------------