├── ActionSheetExtension ├── ActionSheetExtension.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── ActionSheetExtension.xccheckout │ │ └── xcuserdata │ │ │ └── yixiang.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── yixiang.xcuserdatad │ │ └── xcschemes │ │ ├── ActionSheetExtension.xcscheme │ │ └── xcschememanagement.plist ├── ActionSheetExtension │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Model │ │ ├── Item.h │ │ └── Item.m │ ├── View │ │ ├── ItemCell.h │ │ ├── ItemCell.m │ │ ├── PicAndTextActionSheet.h │ │ ├── PicAndTextActionSheet.m │ │ ├── SystemActionSheet.h │ │ └── SystemActionSheet.m │ ├── ViewController.h │ ├── ViewController.m │ ├── journey_phone@2x.png │ └── main.m └── ActionSheetExtensionTests │ ├── ActionSheetExtensionTests.m │ └── Info.plist └── README.md /ActionSheetExtension/ActionSheetExtension.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DAC0EF611B4A3482001725FF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF601B4A3482001725FF /* main.m */; }; 11 | DAC0EF641B4A3482001725FF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF631B4A3482001725FF /* AppDelegate.m */; }; 12 | DAC0EF671B4A3482001725FF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF661B4A3482001725FF /* ViewController.m */; }; 13 | DAC0EF6A1B4A3482001725FF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAC0EF681B4A3482001725FF /* Main.storyboard */; }; 14 | DAC0EF6C1B4A3482001725FF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DAC0EF6B1B4A3482001725FF /* Images.xcassets */; }; 15 | DAC0EF6F1B4A3482001725FF /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = DAC0EF6D1B4A3482001725FF /* LaunchScreen.xib */; }; 16 | DAC0EF7B1B4A3482001725FF /* ActionSheetExtensionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF7A1B4A3482001725FF /* ActionSheetExtensionTests.m */; }; 17 | DAC0EF881B4A3FBB001725FF /* SystemActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF871B4A3FBB001725FF /* SystemActionSheet.m */; }; 18 | DAC0EF8B1B4A40E9001725FF /* Item.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF8A1B4A40E9001725FF /* Item.m */; }; 19 | DAC0EF8E1B4A4161001725FF /* PicAndTextActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF8D1B4A4161001725FF /* PicAndTextActionSheet.m */; }; 20 | DAC0EF911B4A462D001725FF /* ItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DAC0EF901B4A462D001725FF /* ItemCell.m */; }; 21 | DAC0EF931B4A4864001725FF /* journey_phone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAC0EF921B4A4864001725FF /* journey_phone@2x.png */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | DAC0EF751B4A3482001725FF /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = DAC0EF531B4A3482001725FF /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = DAC0EF5A1B4A3482001725FF; 30 | remoteInfo = ActionSheetExtension; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | DAC0EF5B1B4A3482001725FF /* ActionSheetExtension.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ActionSheetExtension.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | DAC0EF5F1B4A3482001725FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | DAC0EF601B4A3482001725FF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | DAC0EF621B4A3482001725FF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | DAC0EF631B4A3482001725FF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | DAC0EF651B4A3482001725FF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 41 | DAC0EF661B4A3482001725FF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 42 | DAC0EF691B4A3482001725FF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | DAC0EF6B1B4A3482001725FF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 44 | DAC0EF6E1B4A3482001725FF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 45 | DAC0EF741B4A3482001725FF /* ActionSheetExtensionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ActionSheetExtensionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | DAC0EF791B4A3482001725FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | DAC0EF7A1B4A3482001725FF /* ActionSheetExtensionTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ActionSheetExtensionTests.m; sourceTree = ""; }; 48 | DAC0EF861B4A3FBB001725FF /* SystemActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemActionSheet.h; sourceTree = ""; }; 49 | DAC0EF871B4A3FBB001725FF /* SystemActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SystemActionSheet.m; sourceTree = ""; }; 50 | DAC0EF891B4A40E9001725FF /* Item.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Item.h; sourceTree = ""; }; 51 | DAC0EF8A1B4A40E9001725FF /* Item.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Item.m; sourceTree = ""; }; 52 | DAC0EF8C1B4A4161001725FF /* PicAndTextActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PicAndTextActionSheet.h; sourceTree = ""; }; 53 | DAC0EF8D1B4A4161001725FF /* PicAndTextActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PicAndTextActionSheet.m; sourceTree = ""; }; 54 | DAC0EF8F1B4A462D001725FF /* ItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ItemCell.h; sourceTree = ""; }; 55 | DAC0EF901B4A462D001725FF /* ItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ItemCell.m; sourceTree = ""; }; 56 | DAC0EF921B4A4864001725FF /* journey_phone@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "journey_phone@2x.png"; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | DAC0EF581B4A3482001725FF /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | DAC0EF711B4A3482001725FF /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | DAC0EF521B4A3482001725FF = { 78 | isa = PBXGroup; 79 | children = ( 80 | DAC0EF5D1B4A3482001725FF /* ActionSheetExtension */, 81 | DAC0EF771B4A3482001725FF /* ActionSheetExtensionTests */, 82 | DAC0EF5C1B4A3482001725FF /* Products */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | DAC0EF5C1B4A3482001725FF /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | DAC0EF5B1B4A3482001725FF /* ActionSheetExtension.app */, 90 | DAC0EF741B4A3482001725FF /* ActionSheetExtensionTests.xctest */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | DAC0EF5D1B4A3482001725FF /* ActionSheetExtension */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | DAC0EF851B4A3F56001725FF /* View */, 99 | DAC0EF841B4A3F3D001725FF /* Model */, 100 | DAC0EF621B4A3482001725FF /* AppDelegate.h */, 101 | DAC0EF631B4A3482001725FF /* AppDelegate.m */, 102 | DAC0EF651B4A3482001725FF /* ViewController.h */, 103 | DAC0EF661B4A3482001725FF /* ViewController.m */, 104 | DAC0EF681B4A3482001725FF /* Main.storyboard */, 105 | DAC0EF6B1B4A3482001725FF /* Images.xcassets */, 106 | DAC0EF6D1B4A3482001725FF /* LaunchScreen.xib */, 107 | DAC0EF5E1B4A3482001725FF /* Supporting Files */, 108 | ); 109 | path = ActionSheetExtension; 110 | sourceTree = ""; 111 | }; 112 | DAC0EF5E1B4A3482001725FF /* Supporting Files */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | DAC0EF921B4A4864001725FF /* journey_phone@2x.png */, 116 | DAC0EF5F1B4A3482001725FF /* Info.plist */, 117 | DAC0EF601B4A3482001725FF /* main.m */, 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | DAC0EF771B4A3482001725FF /* ActionSheetExtensionTests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | DAC0EF7A1B4A3482001725FF /* ActionSheetExtensionTests.m */, 126 | DAC0EF781B4A3482001725FF /* Supporting Files */, 127 | ); 128 | path = ActionSheetExtensionTests; 129 | sourceTree = ""; 130 | }; 131 | DAC0EF781B4A3482001725FF /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | DAC0EF791B4A3482001725FF /* Info.plist */, 135 | ); 136 | name = "Supporting Files"; 137 | sourceTree = ""; 138 | }; 139 | DAC0EF841B4A3F3D001725FF /* Model */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | DAC0EF891B4A40E9001725FF /* Item.h */, 143 | DAC0EF8A1B4A40E9001725FF /* Item.m */, 144 | ); 145 | path = Model; 146 | sourceTree = ""; 147 | }; 148 | DAC0EF851B4A3F56001725FF /* View */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | DAC0EF861B4A3FBB001725FF /* SystemActionSheet.h */, 152 | DAC0EF871B4A3FBB001725FF /* SystemActionSheet.m */, 153 | DAC0EF8C1B4A4161001725FF /* PicAndTextActionSheet.h */, 154 | DAC0EF8D1B4A4161001725FF /* PicAndTextActionSheet.m */, 155 | DAC0EF8F1B4A462D001725FF /* ItemCell.h */, 156 | DAC0EF901B4A462D001725FF /* ItemCell.m */, 157 | ); 158 | path = View; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | DAC0EF5A1B4A3482001725FF /* ActionSheetExtension */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = DAC0EF7E1B4A3482001725FF /* Build configuration list for PBXNativeTarget "ActionSheetExtension" */; 167 | buildPhases = ( 168 | DAC0EF571B4A3482001725FF /* Sources */, 169 | DAC0EF581B4A3482001725FF /* Frameworks */, 170 | DAC0EF591B4A3482001725FF /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = ActionSheetExtension; 177 | productName = ActionSheetExtension; 178 | productReference = DAC0EF5B1B4A3482001725FF /* ActionSheetExtension.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | DAC0EF731B4A3482001725FF /* ActionSheetExtensionTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = DAC0EF811B4A3482001725FF /* Build configuration list for PBXNativeTarget "ActionSheetExtensionTests" */; 184 | buildPhases = ( 185 | DAC0EF701B4A3482001725FF /* Sources */, 186 | DAC0EF711B4A3482001725FF /* Frameworks */, 187 | DAC0EF721B4A3482001725FF /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | DAC0EF761B4A3482001725FF /* PBXTargetDependency */, 193 | ); 194 | name = ActionSheetExtensionTests; 195 | productName = ActionSheetExtensionTests; 196 | productReference = DAC0EF741B4A3482001725FF /* ActionSheetExtensionTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | DAC0EF531B4A3482001725FF /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastUpgradeCheck = 0630; 206 | ORGANIZATIONNAME = yixiang; 207 | TargetAttributes = { 208 | DAC0EF5A1B4A3482001725FF = { 209 | CreatedOnToolsVersion = 6.3.2; 210 | }; 211 | DAC0EF731B4A3482001725FF = { 212 | CreatedOnToolsVersion = 6.3.2; 213 | TestTargetID = DAC0EF5A1B4A3482001725FF; 214 | }; 215 | }; 216 | }; 217 | buildConfigurationList = DAC0EF561B4A3482001725FF /* Build configuration list for PBXProject "ActionSheetExtension" */; 218 | compatibilityVersion = "Xcode 3.2"; 219 | developmentRegion = English; 220 | hasScannedForEncodings = 0; 221 | knownRegions = ( 222 | en, 223 | Base, 224 | ); 225 | mainGroup = DAC0EF521B4A3482001725FF; 226 | productRefGroup = DAC0EF5C1B4A3482001725FF /* Products */; 227 | projectDirPath = ""; 228 | projectRoot = ""; 229 | targets = ( 230 | DAC0EF5A1B4A3482001725FF /* ActionSheetExtension */, 231 | DAC0EF731B4A3482001725FF /* ActionSheetExtensionTests */, 232 | ); 233 | }; 234 | /* End PBXProject section */ 235 | 236 | /* Begin PBXResourcesBuildPhase section */ 237 | DAC0EF591B4A3482001725FF /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | DAC0EF6A1B4A3482001725FF /* Main.storyboard in Resources */, 242 | DAC0EF6F1B4A3482001725FF /* LaunchScreen.xib in Resources */, 243 | DAC0EF931B4A4864001725FF /* journey_phone@2x.png in Resources */, 244 | DAC0EF6C1B4A3482001725FF /* Images.xcassets in Resources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | DAC0EF721B4A3482001725FF /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXResourcesBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | DAC0EF571B4A3482001725FF /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | DAC0EF8B1B4A40E9001725FF /* Item.m in Sources */, 263 | DAC0EF671B4A3482001725FF /* ViewController.m in Sources */, 264 | DAC0EF641B4A3482001725FF /* AppDelegate.m in Sources */, 265 | DAC0EF911B4A462D001725FF /* ItemCell.m in Sources */, 266 | DAC0EF881B4A3FBB001725FF /* SystemActionSheet.m in Sources */, 267 | DAC0EF611B4A3482001725FF /* main.m in Sources */, 268 | DAC0EF8E1B4A4161001725FF /* PicAndTextActionSheet.m in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | DAC0EF701B4A3482001725FF /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | DAC0EF7B1B4A3482001725FF /* ActionSheetExtensionTests.m in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXTargetDependency section */ 283 | DAC0EF761B4A3482001725FF /* PBXTargetDependency */ = { 284 | isa = PBXTargetDependency; 285 | target = DAC0EF5A1B4A3482001725FF /* ActionSheetExtension */; 286 | targetProxy = DAC0EF751B4A3482001725FF /* PBXContainerItemProxy */; 287 | }; 288 | /* End PBXTargetDependency section */ 289 | 290 | /* Begin PBXVariantGroup section */ 291 | DAC0EF681B4A3482001725FF /* Main.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | DAC0EF691B4A3482001725FF /* Base */, 295 | ); 296 | name = Main.storyboard; 297 | sourceTree = ""; 298 | }; 299 | DAC0EF6D1B4A3482001725FF /* LaunchScreen.xib */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | DAC0EF6E1B4A3482001725FF /* Base */, 303 | ); 304 | name = LaunchScreen.xib; 305 | sourceTree = ""; 306 | }; 307 | /* End PBXVariantGroup section */ 308 | 309 | /* Begin XCBuildConfiguration section */ 310 | DAC0EF7C1B4A3482001725FF /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 315 | CLANG_CXX_LIBRARY = "libc++"; 316 | CLANG_ENABLE_MODULES = YES; 317 | CLANG_ENABLE_OBJC_ARC = YES; 318 | CLANG_WARN_BOOL_CONVERSION = YES; 319 | CLANG_WARN_CONSTANT_CONVERSION = YES; 320 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 321 | CLANG_WARN_EMPTY_BODY = YES; 322 | CLANG_WARN_ENUM_CONVERSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_UNREACHABLE_CODE = YES; 326 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 327 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 328 | COPY_PHASE_STRIP = NO; 329 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 330 | ENABLE_STRICT_OBJC_MSGSEND = YES; 331 | GCC_C_LANGUAGE_STANDARD = gnu99; 332 | GCC_DYNAMIC_NO_PIC = NO; 333 | GCC_NO_COMMON_BLOCKS = YES; 334 | GCC_OPTIMIZATION_LEVEL = 0; 335 | GCC_PREPROCESSOR_DEFINITIONS = ( 336 | "DEBUG=1", 337 | "$(inherited)", 338 | ); 339 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 340 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 341 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 342 | GCC_WARN_UNDECLARED_SELECTOR = YES; 343 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 344 | GCC_WARN_UNUSED_FUNCTION = YES; 345 | GCC_WARN_UNUSED_VARIABLE = YES; 346 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 347 | MTL_ENABLE_DEBUG_INFO = YES; 348 | ONLY_ACTIVE_ARCH = YES; 349 | SDKROOT = iphoneos; 350 | }; 351 | name = Debug; 352 | }; 353 | DAC0EF7D1B4A3482001725FF /* Release */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ALWAYS_SEARCH_USER_PATHS = NO; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_WARN_BOOL_CONVERSION = YES; 362 | CLANG_WARN_CONSTANT_CONVERSION = YES; 363 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 364 | CLANG_WARN_EMPTY_BODY = YES; 365 | CLANG_WARN_ENUM_CONVERSION = YES; 366 | CLANG_WARN_INT_CONVERSION = YES; 367 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 371 | COPY_PHASE_STRIP = NO; 372 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 373 | ENABLE_NS_ASSERTIONS = NO; 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | GCC_C_LANGUAGE_STANDARD = gnu99; 376 | GCC_NO_COMMON_BLOCKS = YES; 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 384 | MTL_ENABLE_DEBUG_INFO = NO; 385 | SDKROOT = iphoneos; 386 | VALIDATE_PRODUCT = YES; 387 | }; 388 | name = Release; 389 | }; 390 | DAC0EF7F1B4A3482001725FF /* Debug */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 394 | INFOPLIST_FILE = ActionSheetExtension/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | }; 398 | name = Debug; 399 | }; 400 | DAC0EF801B4A3482001725FF /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 404 | INFOPLIST_FILE = ActionSheetExtension/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | }; 408 | name = Release; 409 | }; 410 | DAC0EF821B4A3482001725FF /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | BUNDLE_LOADER = "$(TEST_HOST)"; 414 | FRAMEWORK_SEARCH_PATHS = ( 415 | "$(SDKROOT)/Developer/Library/Frameworks", 416 | "$(inherited)", 417 | ); 418 | GCC_PREPROCESSOR_DEFINITIONS = ( 419 | "DEBUG=1", 420 | "$(inherited)", 421 | ); 422 | INFOPLIST_FILE = ActionSheetExtensionTests/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 424 | PRODUCT_NAME = "$(TARGET_NAME)"; 425 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ActionSheetExtension.app/ActionSheetExtension"; 426 | }; 427 | name = Debug; 428 | }; 429 | DAC0EF831B4A3482001725FF /* Release */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | BUNDLE_LOADER = "$(TEST_HOST)"; 433 | FRAMEWORK_SEARCH_PATHS = ( 434 | "$(SDKROOT)/Developer/Library/Frameworks", 435 | "$(inherited)", 436 | ); 437 | INFOPLIST_FILE = ActionSheetExtensionTests/Info.plist; 438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ActionSheetExtension.app/ActionSheetExtension"; 441 | }; 442 | name = Release; 443 | }; 444 | /* End XCBuildConfiguration section */ 445 | 446 | /* Begin XCConfigurationList section */ 447 | DAC0EF561B4A3482001725FF /* Build configuration list for PBXProject "ActionSheetExtension" */ = { 448 | isa = XCConfigurationList; 449 | buildConfigurations = ( 450 | DAC0EF7C1B4A3482001725FF /* Debug */, 451 | DAC0EF7D1B4A3482001725FF /* Release */, 452 | ); 453 | defaultConfigurationIsVisible = 0; 454 | defaultConfigurationName = Release; 455 | }; 456 | DAC0EF7E1B4A3482001725FF /* Build configuration list for PBXNativeTarget "ActionSheetExtension" */ = { 457 | isa = XCConfigurationList; 458 | buildConfigurations = ( 459 | DAC0EF7F1B4A3482001725FF /* Debug */, 460 | DAC0EF801B4A3482001725FF /* Release */, 461 | ); 462 | defaultConfigurationIsVisible = 0; 463 | }; 464 | DAC0EF811B4A3482001725FF /* Build configuration list for PBXNativeTarget "ActionSheetExtensionTests" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | DAC0EF821B4A3482001725FF /* Debug */, 468 | DAC0EF831B4A3482001725FF /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | }; 472 | /* End XCConfigurationList section */ 473 | }; 474 | rootObject = DAC0EF531B4A3482001725FF /* Project object */; 475 | } 476 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension.xcodeproj/project.xcworkspace/xcshareddata/ActionSheetExtension.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 86127503-7610-4B42-BCCB-4AA1B5464FD4 9 | IDESourceControlProjectName 10 | ActionSheetExtension 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 2E49AC4E1152461C774964CAD9C0EBA18DAB8E09 14 | https://github.com/yixiangboy/ActionSheetExtension 15 | 16 | IDESourceControlProjectPath 17 | ActionSheetExtension/ActionSheetExtension.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 2E49AC4E1152461C774964CAD9C0EBA18DAB8E09 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/yixiangboy/ActionSheetExtension 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 2E49AC4E1152461C774964CAD9C0EBA18DAB8E09 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 2E49AC4E1152461C774964CAD9C0EBA18DAB8E09 36 | IDESourceControlWCCName 37 | ActionSheetExtension 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension.xcodeproj/project.xcworkspace/xcuserdata/yixiang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/ActionSheetExtension/1fdcfdca2a6932418c9d857a3eadf287e61e774e/ActionSheetExtension/ActionSheetExtension.xcodeproj/project.xcworkspace/xcuserdata/yixiang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension.xcodeproj/xcuserdata/yixiang.xcuserdatad/xcschemes/ActionSheetExtension.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension.xcodeproj/xcuserdata/yixiang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ActionSheetExtension.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | DAC0EF5A1B4A3482001725FF 16 | 17 | primary 18 | 19 | 20 | DAC0EF731B4A3482001725FF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. 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 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/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 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | alibaba.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/Model/Item.h: -------------------------------------------------------------------------------- 1 | // 2 | // Item.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Item : NSObject 12 | 13 | @property (nonatomic , strong) NSString *icon;//图片地址 14 | 15 | @property (nonatomic , strong) NSString *title;//标题 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/Model/Item.m: -------------------------------------------------------------------------------- 1 | // 2 | // Item.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "Item.h" 10 | 11 | @implementation Item 12 | 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/ItemCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCell.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Item.h" 11 | 12 | #define RGBCOLOR(r, g, b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1] 13 | #define RGBACOLOR(r, g, b, a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)] 14 | //获取设备的物理高度 15 | #define ScreenHeight [UIScreen mainScreen].bounds.size.height 16 | //获取设备的物理宽度 17 | #define ScreenWidth [UIScreen mainScreen].bounds.size.width 18 | 19 | @interface ItemCell : UITableViewCell 20 | 21 | -(void)setData : (Item *)item; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/ItemCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCell.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "ItemCell.h" 10 | 11 | @interface ItemCell() 12 | 13 | @property (nonatomic , strong) UIImageView *leftView; 14 | @property (nonatomic , strong) UILabel *titleLabel; 15 | @property (nonatomic , strong) Item *item; 16 | 17 | @end 18 | 19 | @implementation ItemCell 20 | 21 | //在initWithStyle中,生成控件,将控件添加到self.contentView中 22 | -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ 23 | if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){ 24 | _leftView = [[UIImageView alloc] init]; 25 | _titleLabel = [[UILabel alloc] init]; 26 | _titleLabel.backgroundColor = [UIColor clearColor]; 27 | [self.contentView addSubview:_leftView]; 28 | [self.contentView addSubview:_titleLabel]; 29 | self.selectionStyle = UITableViewCellSelectionStyleNone; 30 | } 31 | return self; 32 | } 33 | 34 | //在layoutSubviews中,设置控件的frame 35 | -(void)layoutSubviews{ 36 | [super layoutSubviews]; 37 | _leftView.frame = CGRectMake(20, (CGRectGetHeight(self.frame)-30)/2, 30, 30); 38 | _titleLabel.frame = CGRectMake(CGRectGetMaxX(_leftView.frame)+15, (CGRectGetHeight(self.frame)-20)/2, 150, 20); 39 | _titleLabel.textColor = [UIColor blueColor]; 40 | } 41 | 42 | //设置数据 43 | -(void)setData:(Item *)item{ 44 | _item = item; 45 | _leftView.image = [UIImage imageNamed:item.icon]; 46 | _titleLabel.text = item.title; 47 | } 48 | 49 | //设置点击事件 50 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 51 | [super setSelected:selected animated:animated]; 52 | if (selected) { 53 | self.backgroundColor = RGBCOLOR(12, 102, 188); 54 | }else{ 55 | self.backgroundColor = [UIColor whiteColor]; 56 | } 57 | 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/PicAndTextActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // PicAndTextActionSheet.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol DownSheetDelegate 12 | 13 | -(void)didSelectIndex : (NSInteger) index; 14 | 15 | @end 16 | 17 | @interface PicAndTextActionSheet : UIView 18 | 19 | @property (nonatomic , strong) id delegate; 20 | 21 | -(id)initWithList : (NSArray *)list title : (NSString *) title; 22 | 23 | -(void) showInView : (UIViewController *)controller; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/PicAndTextActionSheet.m: -------------------------------------------------------------------------------- 1 | // 2 | // PicAndTextActionSheet.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "PicAndTextActionSheet.h" 10 | #import "ItemCell.h" 11 | 12 | @interface PicAndTextActionSheet () 13 | 14 | @property (nonatomic , strong) UITableView *tableview; 15 | @property (nonatomic , strong) NSArray *listData; 16 | @property (nonatomic , strong) NSString * title; 17 | @property (nonatomic , strong) UIView *customerView; 18 | 19 | @end 20 | 21 | @implementation PicAndTextActionSheet 22 | 23 | -(id) initWithList:(NSArray *)list title:(NSString *)title{ 24 | if (self = [super init]) { 25 | self.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight); 26 | self.backgroundColor = RGBACOLOR(160, 160, 160, 0); 27 | 28 | 29 | _tableview = [[UITableView alloc] initWithFrame:CGRectMake(5, 0, ScreenWidth-10, 44*[list count]+45) style:UITableViewStylePlain]; 30 | _tableview.dataSource = self; 31 | _tableview.delegate = self; 32 | _tableview.scrollEnabled = NO; 33 | _tableview.layer.cornerRadius = 5; 34 | 35 | UILabel *cancelLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,CGRectGetHeight(_tableview.frame)+10, ScreenWidth-10, 44)]; 36 | cancelLabel.layer.cornerRadius =5; 37 | cancelLabel.layer.backgroundColor = [UIColor whiteColor].CGColor; 38 | 39 | cancelLabel.text = @"取消"; 40 | cancelLabel.textAlignment = NSTextAlignmentCenter; 41 | cancelLabel.textColor = [UIColor blueColor]; 42 | UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tappedCancel)]; 43 | cancelLabel.userInteractionEnabled = YES; 44 | [cancelLabel addGestureRecognizer:tapRecognizer]; 45 | 46 | _customerView = [[UIView alloc] initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, CGRectGetHeight(_tableview.frame)+60)]; 47 | _customerView.backgroundColor = [UIColor clearColor]; 48 | [_customerView addSubview:_tableview]; 49 | [_customerView addSubview:cancelLabel]; 50 | 51 | [self addSubview:_customerView]; 52 | 53 | 54 | _listData = list; 55 | _title = title; 56 | 57 | } 58 | return self; 59 | } 60 | 61 | //如果tableview处于uiview上面,uiview整个背景有点击事件,但是我们需要如果我们点击tableview的时候,处理tableview的点击事件,而不是uiview的事件。在这里,我们需要判断我们点击事件是否在uiview上还是在uitableview上。 62 | -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ 63 | if([touch.view isKindOfClass:[self class]]){ 64 | return YES; 65 | } 66 | return NO; 67 | } 68 | 69 | -(void)animeData{ 70 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tappedCancel)]; 71 | tapGesture.delegate = self; 72 | [self addGestureRecognizer:tapGesture]; 73 | self.userInteractionEnabled = YES; 74 | 75 | [UIView animateWithDuration:0.25f animations:^{ 76 | self.backgroundColor = RGBACOLOR(160, 160, 160, 0.4); 77 | CGRect originRect = _customerView.frame; 78 | originRect.origin.y = ScreenHeight - CGRectGetHeight(_customerView.frame); 79 | _customerView.frame = originRect; 80 | } completion:^(BOOL finished) { 81 | 82 | }]; 83 | } 84 | 85 | -(void) tappedCancel{ 86 | [UIView animateWithDuration:.25 animations:^{ 87 | self.alpha = 0; 88 | CGRect originRect = _customerView.frame; 89 | originRect.origin.y = ScreenHeight; 90 | _customerView.frame = originRect; 91 | } completion:^(BOOL finished) { 92 | if (finished) { 93 | for (UIView *v in _customerView.subviews) { 94 | [v removeFromSuperview]; 95 | } 96 | [_customerView removeFromSuperview]; 97 | } 98 | }]; 99 | } 100 | 101 | - (void) showInView:(UIViewController *)controller{ 102 | if (controller) { 103 | [controller.view addSubview:self]; 104 | }else{ 105 | [[UIApplication sharedApplication].delegate.window.rootViewController.view addSubview:self]; 106 | } 107 | [self animeData]; 108 | } 109 | 110 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 111 | return 1; 112 | } 113 | 114 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 115 | return [_listData count]+1; 116 | } 117 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 118 | if (indexPath.row == 0) { 119 | return 45; 120 | } 121 | return 44; 122 | } 123 | 124 | -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 125 | if (indexPath.row == 0) { 126 | static NSString *cellIdentifier = @"TitleCell"; 127 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 128 | if (cell==nil) { 129 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 130 | } 131 | cell.textLabel.text = _title; 132 | cell.textLabel.textAlignment = NSTextAlignmentCenter; 133 | cell.userInteractionEnabled = NO; 134 | return cell; 135 | }else{ 136 | static NSString *cellIdentifier = @"DownSheetCell"; 137 | ItemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 138 | if (cell==nil) { 139 | cell = [[ItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 140 | } 141 | [cell setData:[_listData objectAtIndex:indexPath.row-1]]; 142 | return cell; 143 | } 144 | } 145 | 146 | -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 147 | [self tappedCancel]; 148 | if (_delegate != nil && [_delegate respondsToSelector:@selector(didSelectIndex:)]) { 149 | [_delegate didSelectIndex:indexPath.row]; 150 | return; 151 | } 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/SystemActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // SystemActionSheet.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SystemActionSheet : UIView 12 | 13 | -(id) initViewWithPhone : (NSString *) phone title : (NSString *) title; 14 | 15 | -(id) initViewWithMultiPhone:(NSArray *) array title :(NSString *)title; 16 | 17 | -(void) show; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/View/SystemActionSheet.m: -------------------------------------------------------------------------------- 1 | // 2 | // SystemActionSheet.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "SystemActionSheet.h" 10 | 11 | @interface SystemActionSheet() 12 | 13 | @property (nonatomic , strong) UIActionSheet *actionSheet; 14 | 15 | @end 16 | 17 | @implementation SystemActionSheet 18 | 19 | -(id)initViewWithPhone:(NSString *)phone title:(NSString *)title{ 20 | if (self = [self init]) { 21 | _actionSheet.title = title; 22 | [_actionSheet addButtonWithTitle:phone]; 23 | } 24 | return self; 25 | } 26 | 27 | -(id)initViewWithMultiPhone:(NSArray *)array title:(NSString *)title{ 28 | 29 | if (self = [self init]) { 30 | _actionSheet.title = title; 31 | for (NSString *phone in array) { 32 | [_actionSheet addButtonWithTitle:phone]; 33 | } 34 | } 35 | return self; 36 | } 37 | 38 | -(id)init{ 39 | CGRect bounds = [[UIScreen mainScreen] bounds]; 40 | if (self = [super initWithFrame:bounds]) { 41 | self.backgroundColor = [UIColor clearColor]; 42 | 43 | _actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 44 | 45 | _actionSheet.cancelButtonIndex = [_actionSheet addButtonWithTitle:@"取消"]; 46 | } 47 | return self; 48 | } 49 | 50 | -(void) show{ 51 | [_actionSheet showInView : self]; 52 | } 53 | 54 | -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ 55 | if (buttonIndex == actionSheet.cancelButtonIndex) { 56 | [self close]; 57 | }else{ 58 | [self onPhoneButtonClick:[_actionSheet buttonTitleAtIndex:buttonIndex]]; 59 | } 60 | } 61 | 62 | 63 | 64 | - (void)onPhoneButtonClick:(NSString *)phone { 65 | NSLog(@"%@",phone); 66 | NSString *urlString = [NSString stringWithFormat:@"tel://%@", phone]; 67 | BOOL result = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; 68 | if (!result) { 69 | [self close]; 70 | NSLog(@"亲,您的设备不支持拨打电话功能"); 71 | } else { 72 | [self close]; 73 | } 74 | } 75 | 76 | -(void) close{ 77 | for (UIView *v in [self subviews]) { 78 | [v removeFromSuperview]; 79 | } 80 | [self removeFromSuperview]; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Item.h" 11 | #import "SystemActionSheet.h" 12 | #import "PicAndTextActionSheet.h" 13 | 14 | @interface ViewController () 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | CGRect bounds = self.view.bounds; 23 | UIButton *dialPhone1 = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetWidth(bounds)/2-100, 120, 200, 40)]; 24 | dialPhone1.backgroundColor = [UIColor grayColor]; 25 | [dialPhone1 setTitle:@"系统自带ActionSheet" forState:UIControlStateNormal]; 26 | [dialPhone1 addTarget:self action:@selector(dialPhone1) forControlEvents:UIControlEventTouchUpInside]; 27 | 28 | UIButton *dialPhone2 = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetWidth(bounds)/2-100, 200, 200, 40)]; 29 | dialPhone2.backgroundColor = [UIColor grayColor]; 30 | [dialPhone2 setTitle:@"图文混排ActionSheet" forState:UIControlStateNormal]; 31 | [dialPhone2 addTarget:self action:@selector(dialPhone2) forControlEvents:UIControlEventTouchUpInside]; 32 | 33 | [self.view addSubview:dialPhone1]; 34 | [self.view addSubview:dialPhone2]; 35 | 36 | } 37 | 38 | 39 | -(void) dialPhone1 { 40 | NSString *number1 = @"15951973122"; 41 | NSString *number2 = @"15951973124"; 42 | NSString *number3 = @"15951973127"; 43 | NSArray *array = [NSArray arrayWithObjects:number1, number2,number3, nil]; 44 | 45 | //SystemActionSheet *dialPhoneView = [[SystemActionSheet alloc] initViewWithPhone:number1 title:@"拨打电话"]; 46 | SystemActionSheet *dialPhoneView = [[SystemActionSheet alloc] initViewWithMultiPhone:array title:@"拨打电话"]; 47 | [dialPhoneView show]; 48 | [self.view addSubview:dialPhoneView]; 49 | 50 | } 51 | 52 | -(void) dialPhone2 { 53 | Item *item1 = [[Item alloc] init]; 54 | item1.icon = @"journey_phone"; 55 | item1.title = @"15195905888"; 56 | Item *item2 = [[Item alloc] init]; 57 | item2.icon = @"journey_phone"; 58 | item2.title = @"15195905777"; 59 | Item *item3 = [[Item alloc] init]; 60 | item3.icon = @"journey_phone"; 61 | item3.title = @"15195905777"; 62 | NSArray *listData = [NSArray arrayWithObjects:item1,item2,item3, nil]; 63 | 64 | PicAndTextActionSheet *sheet = [[PicAndTextActionSheet alloc] initWithList:listData title:@"拨打电话"]; 65 | sheet.delegate = self; 66 | [sheet showInView:self]; 67 | 68 | } 69 | 70 | -(void) didSelectIndex:(NSInteger)index{ 71 | UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:[NSString stringWithFormat:@"您当前点击的是第%zi个按钮",index] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; 72 | [alert show]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/journey_phone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yixiangboy/ActionSheetExtension/1fdcfdca2a6932418c9d857a3eadf287e61e774e/ActionSheetExtension/ActionSheetExtension/journey_phone@2x.png -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtension/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ActionSheetExtension 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. 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 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtensionTests/ActionSheetExtensionTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheetExtensionTests.m 3 | // ActionSheetExtensionTests 4 | // 5 | // Created by yixiang on 15/7/6. 6 | // Copyright (c) 2015年 yixiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ActionSheetExtensionTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ActionSheetExtensionTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ActionSheetExtension/ActionSheetExtensionTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | alibaba.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ActionSheetExtension 2 | 扩展IOS系统自带ActionSheet,使其支持图文混排。 3 | ==== 4 | ##一、简介 5 | UIActionSheet是IOS提供给我们开发者的底部弹出菜单控件,一般用于菜单选择、操作确认、删除确认等功能。
IOS官方提供的以下方式对UIActionView进行实例化:
6 | ``` 7 | - (instancetype)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... ); 8 | ``` 9 | 从这个api我们可以看出,我们只能设置文本标题,包括destructiveButtonTitle、cancelButtonTitle和otherButtonTitles,官方提供的该控件并不支持图文混排。但有的时候,交互提给我们的需求又需要我们的ActionSheet具有图文混排的效果,那就需要我们自己仿造系统自带的ActionSheet,完成该需求。
项目演示如下:
10 | ![演示图片](http://img.my.csdn.net/uploads/201507/06/1436182724_3996.gif) 11 |
12 | ##二、使用说明 13 | ###第一步、构建数据模型 14 | 15 | ``` 16 | @interface Item : NSObject 17 | @property (nonatomic , strong) NSString *icon;//图片地址 18 | @property (nonatomic , strong) NSString *title;//标题 19 | @end 20 | ``` 21 | ###第二步、根据数据模型构建数据 22 | 23 | ``` 24 | Item *item1 = [[Item alloc] init]; 25 | item1.icon = @"journey_phone"; 26 | item1.title = @"15195905888"; 27 | Item *item2 = [[Item alloc] init]; 28 | item2.icon = @"journey_phone"; 29 | item2.title = @"15195905777"; 30 | Item *item3 = [[Item alloc] init]; 31 | item3.icon = @"journey_phone"; 32 | item3.title = @"15195905777"; 33 | NSArray *listData = [NSArray arrayWithObjects:item1,item2,item3, nil]; 34 | ``` 35 | ###第三步、使用以上数据将控件初始化 36 | 37 | ``` 38 | PicAndTextActionSheet *sheet = [[PicAndTextActionSheet alloc] initWithList:listData title:@"拨打电话"]; 39 | sheet.delegate = self;//该控件使用的代理模式 40 | [sheet showInView:self]; 41 | ``` 42 | 因为该控件使用了代理模式,所以在当前Controller需要实现以下代理方法: 43 | 44 | ``` 45 | -(void) didSelectIndex:(NSInteger)index{ 46 | } 47 | ``` 48 | 该代理方法,主要是在Controller中能够实现在自定义ActionSheet中的点击事件。 49 |
50 | ##三、实现原理 51 | 因为ActionSheet不能支持图片的显示,所以我们就放弃使用扩展UIActionSheet控件的方法。我在本项目中使用的是UITableView+动画,高仿ActionSheet的方法。UTableView可以制作列表选项,动画可以实现系统自带ActionSheet的自底向上和渐变效果。
52 | 注意点:
53 | 54 | 如果tableview处于uiview上面,uiview整个背景有点击事件,但是我们需要如果我们点击tableview的时候,处理tableview的点击事件,而不是uiview的事件。在这里,我们需要判断我们点击事件是否在uiview上还是在uitableview上。
55 | 解决方案如下:
56 | 1、实现代理: 57 | 58 | ``` 59 | 60 | ``` 61 | 62 | 2、让gesture设置为代理 63 | 64 | ``` 65 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tappedCancel)]; 66 | tapGesture.delegate = self; 67 | ``` 68 | 69 | 3、实现代理方法,判断点击的是否是uiview还是tableview 70 | 71 | ``` 72 | -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ 73 | if([touch.view isKindOfClass:[self class]]){ 74 | return YES; 75 | } 76 | return NO; 77 | } 78 | ``` 79 | ##四、总结 80 | 任何一个复杂控件,基本上都是有基础控件组合实现而成。该扩展的ActionSheet也可以用于以下场景: 81 | ![场景1](http://code4app.qiniudn.com/photo/547abb9d933bf02c038b6867_1.gif) 82 |

83 | ![场景2](http://code4app.qiniudn.com/photo/539bf71c933bf094418b50a6_1.gif) 84 |
85 | ### 五、下载地址 86 | github下载地址:[https://github.com/yixiangboy/ActionSheetExtension](https://github.com/yixiangboy/ActionSheetExtension)
87 | 如果觉得对你还有些用,给一颗star吧。你的支持是我继续的动力。
88 | blog地址:[http://blog.csdn.net/yixiangboy/article/details/46778417](http://blog.csdn.net/yixiangboy/article/details/46778417) 89 |
90 | ###博主的话 91 | 以前看过很多别人的博客,学到不少东西。现在准备自己也开始写写博客,希望能够帮到一些人。
92 | 我的联系方式:[我的微博](http://weibo.com/5612984599/profile?topnav=1&wvr=6) 93 | --------------------------------------------------------------------------------