├── LICENSE ├── README.md ├── UMAlertView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── najanda.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── najanda.xcuserdatad │ └── xcschemes │ ├── UMAlertView.xcscheme │ └── xcschememanagement.plist └── UMAlertView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── UMAlertView ├── UMAlertView.h └── UMAlertView.m ├── ViewController.h ├── ViewController.m └── main.m /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UMAlertView 2 | 3 | ## Fixed 4 | Date : 2016. 07. 24 5 | Add cancel button option 6 | 7 | ## Manually 8 | 9 | 1. Download the latest code version . 10 | 2. Open your project in Xcode, drag the UMAlertView folder into your project. Make sure to select Copy items when asked if you extracted the code archive outside of your project. 11 | 3. You need it with Import UMAlertView.h & UMAlertView.m 12 | 13 | ## Function 14 | 15 | ```objc 16 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton; 17 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton duration:(CGFloat)time; 18 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed; 19 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data duration:(CGFloat)time haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed; 20 | 21 | - (void)um_dismissAlertView; 22 | - (void)um_dismissAlertViewCompletion:(void(^)(void))complete; 23 | ``` 24 | 25 | ## Usage 26 | 27 | Init, Delegate 28 | ```objc 29 | umAlertView = [[UMAlertView alloc] init]; 30 | umAlertView.delegate = self; 31 | ``` 32 | 33 | Delegate Method 34 | ```objc 35 | - (void)selectUMAlertButton; 36 | - (void)selectUMAlertCancelButton; 37 | ``` 38 | 39 | Action 40 | ```objc 41 | data = [[NSArray alloc] initWithObjects:@"UMData1", @"UMData2", nil]; 42 | [umAlertView um_showAlertViewTitle:@"UMAlertView" pickerData:data haveCancelButton:YES completion:^{ 43 | NSLog(@"UMAlertView show success"); 44 | }]; 45 | ``` 46 | 47 | Dismiss 48 | ```objc 49 | [umAlertView um_dismissAlertView]; 50 | [umAlertView um_dismissAlertViewCompletion:^{ 51 | NSLog(@"UMAlertView dismiss success"); 52 | }]; 53 | ``` 54 | 55 | ## Contact 56 | 57 | ##### If you want to contact me, send email to najanda89@gmail.com 58 | ##### Twitter : @najanda89 59 | 60 | ## License 61 | 62 | UMAlertView is released under the MIT license. See LICENSE for details. 63 | -------------------------------------------------------------------------------- /UMAlertView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FF6FEC8A1D423BB10026E209 /* UMAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = FF6FEC891D423BB10026E209 /* UMAlertView.m */; }; 11 | FFD9F4721D41F5B4008A38E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FFD9F4711D41F5B4008A38E0 /* main.m */; }; 12 | FFD9F4751D41F5B4008A38E0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FFD9F4741D41F5B4008A38E0 /* AppDelegate.m */; }; 13 | FFD9F4781D41F5B4008A38E0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FFD9F4771D41F5B4008A38E0 /* ViewController.m */; }; 14 | FFD9F47B1D41F5B4008A38E0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FFD9F4791D41F5B4008A38E0 /* Main.storyboard */; }; 15 | FFD9F47D1D41F5B4008A38E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FFD9F47C1D41F5B4008A38E0 /* Assets.xcassets */; }; 16 | FFD9F4801D41F5B4008A38E0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FFD9F47E1D41F5B4008A38E0 /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | FF6FEC881D423BB10026E209 /* UMAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UMAlertView.h; path = UMAlertView/UMAlertView.h; sourceTree = ""; }; 21 | FF6FEC891D423BB10026E209 /* UMAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UMAlertView.m; path = UMAlertView/UMAlertView.m; sourceTree = ""; }; 22 | FFD9F46D1D41F5B4008A38E0 /* UMAlertView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UMAlertView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | FFD9F4711D41F5B4008A38E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | FFD9F4731D41F5B4008A38E0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | FFD9F4741D41F5B4008A38E0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | FFD9F4761D41F5B4008A38E0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | FFD9F4771D41F5B4008A38E0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 28 | FFD9F47A1D41F5B4008A38E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | FFD9F47C1D41F5B4008A38E0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | FFD9F47F1D41F5B4008A38E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | FFD9F4811D41F5B4008A38E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | FFD9F46A1D41F5B4008A38E0 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | FF6FEC871D423BA30026E209 /* UMAlertView */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | FF6FEC881D423BB10026E209 /* UMAlertView.h */, 49 | FF6FEC891D423BB10026E209 /* UMAlertView.m */, 50 | ); 51 | name = UMAlertView; 52 | sourceTree = ""; 53 | }; 54 | FFD9F4641D41F5B4008A38E0 = { 55 | isa = PBXGroup; 56 | children = ( 57 | FFD9F46F1D41F5B4008A38E0 /* UMAlertView */, 58 | FFD9F46E1D41F5B4008A38E0 /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | FFD9F46E1D41F5B4008A38E0 /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | FFD9F46D1D41F5B4008A38E0 /* UMAlertView.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | FFD9F46F1D41F5B4008A38E0 /* UMAlertView */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | FF6FEC871D423BA30026E209 /* UMAlertView */, 74 | FFD9F4731D41F5B4008A38E0 /* AppDelegate.h */, 75 | FFD9F4741D41F5B4008A38E0 /* AppDelegate.m */, 76 | FFD9F4761D41F5B4008A38E0 /* ViewController.h */, 77 | FFD9F4771D41F5B4008A38E0 /* ViewController.m */, 78 | FFD9F4791D41F5B4008A38E0 /* Main.storyboard */, 79 | FFD9F47C1D41F5B4008A38E0 /* Assets.xcassets */, 80 | FFD9F47E1D41F5B4008A38E0 /* LaunchScreen.storyboard */, 81 | FFD9F4811D41F5B4008A38E0 /* Info.plist */, 82 | FFD9F4701D41F5B4008A38E0 /* Supporting Files */, 83 | ); 84 | path = UMAlertView; 85 | sourceTree = ""; 86 | }; 87 | FFD9F4701D41F5B4008A38E0 /* Supporting Files */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | FFD9F4711D41F5B4008A38E0 /* main.m */, 91 | ); 92 | name = "Supporting Files"; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | FFD9F46C1D41F5B4008A38E0 /* UMAlertView */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = FFD9F4841D41F5B4008A38E0 /* Build configuration list for PBXNativeTarget "UMAlertView" */; 101 | buildPhases = ( 102 | FFD9F4691D41F5B4008A38E0 /* Sources */, 103 | FFD9F46A1D41F5B4008A38E0 /* Frameworks */, 104 | FFD9F46B1D41F5B4008A38E0 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = UMAlertView; 111 | productName = UMAlertView; 112 | productReference = FFD9F46D1D41F5B4008A38E0 /* UMAlertView.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | FFD9F4651D41F5B4008A38E0 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0730; 122 | ORGANIZATIONNAME = Jyo; 123 | TargetAttributes = { 124 | FFD9F46C1D41F5B4008A38E0 = { 125 | CreatedOnToolsVersion = 7.3.1; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = FFD9F4681D41F5B4008A38E0 /* Build configuration list for PBXProject "UMAlertView" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = FFD9F4641D41F5B4008A38E0; 138 | productRefGroup = FFD9F46E1D41F5B4008A38E0 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | FFD9F46C1D41F5B4008A38E0 /* UMAlertView */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | FFD9F46B1D41F5B4008A38E0 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | FFD9F4801D41F5B4008A38E0 /* LaunchScreen.storyboard in Resources */, 153 | FFD9F47D1D41F5B4008A38E0 /* Assets.xcassets in Resources */, 154 | FFD9F47B1D41F5B4008A38E0 /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | FFD9F4691D41F5B4008A38E0 /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | FFD9F4781D41F5B4008A38E0 /* ViewController.m in Sources */, 166 | FF6FEC8A1D423BB10026E209 /* UMAlertView.m in Sources */, 167 | FFD9F4751D41F5B4008A38E0 /* AppDelegate.m in Sources */, 168 | FFD9F4721D41F5B4008A38E0 /* main.m in Sources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXSourcesBuildPhase section */ 173 | 174 | /* Begin PBXVariantGroup section */ 175 | FFD9F4791D41F5B4008A38E0 /* Main.storyboard */ = { 176 | isa = PBXVariantGroup; 177 | children = ( 178 | FFD9F47A1D41F5B4008A38E0 /* Base */, 179 | ); 180 | name = Main.storyboard; 181 | sourceTree = ""; 182 | }; 183 | FFD9F47E1D41F5B4008A38E0 /* LaunchScreen.storyboard */ = { 184 | isa = PBXVariantGroup; 185 | children = ( 186 | FFD9F47F1D41F5B4008A38E0 /* Base */, 187 | ); 188 | name = LaunchScreen.storyboard; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXVariantGroup section */ 192 | 193 | /* Begin XCBuildConfiguration section */ 194 | FFD9F4821D41F5B4008A38E0 /* Debug */ = { 195 | isa = XCBuildConfiguration; 196 | buildSettings = { 197 | ALWAYS_SEARCH_USER_PATHS = NO; 198 | CLANG_ANALYZER_NONNULL = YES; 199 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 200 | CLANG_CXX_LIBRARY = "libc++"; 201 | CLANG_ENABLE_MODULES = YES; 202 | CLANG_ENABLE_OBJC_ARC = YES; 203 | CLANG_WARN_BOOL_CONVERSION = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INT_CONVERSION = YES; 209 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 210 | CLANG_WARN_UNREACHABLE_CODE = YES; 211 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 212 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = dwarf; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | }; 236 | name = Debug; 237 | }; 238 | FFD9F4831D41F5B4008A38E0 /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_EMPTY_BODY = YES; 251 | CLANG_WARN_ENUM_CONVERSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | FFD9F4851D41F5B4008A38E0 /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | INFOPLIST_FILE = UMAlertView/Info.plist; 281 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 282 | PRODUCT_BUNDLE_IDENTIFIER = com.zzzbag.UMAlertView; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | }; 285 | name = Debug; 286 | }; 287 | FFD9F4861D41F5B4008A38E0 /* Release */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | INFOPLIST_FILE = UMAlertView/Info.plist; 292 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 293 | PRODUCT_BUNDLE_IDENTIFIER = com.zzzbag.UMAlertView; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | }; 296 | name = Release; 297 | }; 298 | /* End XCBuildConfiguration section */ 299 | 300 | /* Begin XCConfigurationList section */ 301 | FFD9F4681D41F5B4008A38E0 /* Build configuration list for PBXProject "UMAlertView" */ = { 302 | isa = XCConfigurationList; 303 | buildConfigurations = ( 304 | FFD9F4821D41F5B4008A38E0 /* Debug */, 305 | FFD9F4831D41F5B4008A38E0 /* Release */, 306 | ); 307 | defaultConfigurationIsVisible = 0; 308 | defaultConfigurationName = Release; 309 | }; 310 | FFD9F4841D41F5B4008A38E0 /* Build configuration list for PBXNativeTarget "UMAlertView" */ = { 311 | isa = XCConfigurationList; 312 | buildConfigurations = ( 313 | FFD9F4851D41F5B4008A38E0 /* Debug */, 314 | FFD9F4861D41F5B4008A38E0 /* Release */, 315 | ); 316 | defaultConfigurationIsVisible = 0; 317 | defaultConfigurationName = Release; 318 | }; 319 | /* End XCConfigurationList section */ 320 | }; 321 | rootObject = FFD9F4651D41F5B4008A38E0 /* Project object */; 322 | } 323 | -------------------------------------------------------------------------------- /UMAlertView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UMAlertView.xcodeproj/project.xcworkspace/xcuserdata/najanda.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najanda89/UMAlertView/09348d0c2d555ee142d88f9e14791140456cb432/UMAlertView.xcodeproj/project.xcworkspace/xcuserdata/najanda.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /UMAlertView.xcodeproj/xcuserdata/najanda.xcuserdatad/xcschemes/UMAlertView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /UMAlertView.xcodeproj/xcuserdata/najanda.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UMAlertView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | FFD9F46C1D41F5B4008A38E0 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /UMAlertView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. 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 | -------------------------------------------------------------------------------- /UMAlertView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. 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 | -------------------------------------------------------------------------------- /UMAlertView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /UMAlertView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /UMAlertView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /UMAlertView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /UMAlertView/UMAlertView/UMAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // UMAlertView.h 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UMAlertViewDelegate 12 | 13 | - (void)selectUMAlertButton; 14 | - (void)selectUMAlertCancelButton; 15 | 16 | @end 17 | 18 | @interface UMAlertView : UIView 19 | 20 | 21 | @property NSString *selectData; 22 | 23 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton; 24 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton duration:(CGFloat)time; 25 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed; 26 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data duration:(CGFloat)time haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed; 27 | 28 | - (void)um_dismissAlertView; 29 | - (void)um_dismissAlertViewCompletion:(void(^)(void))complete; 30 | 31 | // delegate 32 | @property (weak, nonatomic) id delegate; 33 | 34 | 35 | 36 | @end 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /UMAlertView/UMAlertView/UMAlertView.m: -------------------------------------------------------------------------------- 1 | // 2 | // UMAlertView.m 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. All rights reserved. 7 | // 8 | 9 | #import "UMAlertView.h" 10 | 11 | #define UM_ALERT_VIEW_CORNER_RADIUS 3.0f // AlertView Corner Radius 12 | #define UM_ALERT_VIEW_MARGIN_ZERO 0.0f 13 | #define UM_ALERT_VIEW_MARGIN 50.0f 14 | #define UM_ALERT_VIEW_HEIGHT 50.0f 15 | #define UM_ALERT_VIEW_TITLE_TEXT_COLOR [UIColor blackColor] // AlertView Title Color 16 | #define UM_ALERT_VIEW_SELECT_BUTTON_COLOR [UIColor grayColor] // AlertView Button Background Color 17 | #define UM_ALERT_VIEW_SELECT_CANCEL_BUTTON_COLOR [UIColor lightGrayColor] 18 | #define UM_ALERT_VIEW_ALL_BACKGROUND_COLOR [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.0] 19 | #define UM_ALERT_VIEW_SELECT_BUTTON_TITLE @"Select" // AlertView Button Title 20 | #define UM_ALERT_VIEW_SELECT_CANCEL_BUTTON_TITLE @"Cancel" 21 | 22 | static CGFloat duration = 1.0f; 23 | static NSArray *pickerListData = nil; 24 | static BOOL isScrollPickerView = NO; 25 | static NSInteger pickerRow = 0; 26 | 27 | @interface UMAlertView() 28 | 29 | @property (nonatomic, weak) UIView *umAlertView; 30 | @property (nonatomic, weak) UILabel *alertTitleLabel; 31 | @property (nonatomic, weak) UIPickerView *dataPicker; 32 | @property (nonatomic, weak) UIButton *selectButton; 33 | @end 34 | 35 | @implementation UMAlertView 36 | 37 | // title, data 38 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton { 39 | 40 | [self um_showAlertViewTitle:title pickerData:data duration:duration haveCancelButton:haveCancelButton completion:nil]; 41 | } 42 | 43 | // title, data, completion block 44 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed { 45 | 46 | [self um_showAlertViewTitle:title pickerData:data duration:duration haveCancelButton:haveCancelButton completion:completed]; 47 | } 48 | 49 | // title, data, animation time 50 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data haveCancelButton:(BOOL)haveCancelButton duration:(CGFloat)time { 51 | 52 | [self um_showAlertViewTitle:title pickerData:data duration:time haveCancelButton:haveCancelButton completion:nil]; 53 | } 54 | 55 | // title, data, animation time, completion block 56 | - (void)um_showAlertViewTitle:(NSString *)title pickerData:(NSArray *)data duration:(CGFloat)time haveCancelButton:(BOOL)haveCancelButton completion:(void (^)(void))completed { 57 | 58 | pickerListData = data; 59 | duration = time; 60 | isScrollPickerView = NO; 61 | 62 | UIView *keyWindow = [self keyWindow]; 63 | 64 | UIView *umAlertView =[[UIView alloc] initWithFrame:CGRectMake(UM_ALERT_VIEW_MARGIN_ZERO, UM_ALERT_VIEW_MARGIN_ZERO, keyWindow.frame.size.width - UM_ALERT_VIEW_MARGIN, UM_ALERT_VIEW_MARGIN * 5)]; 65 | [umAlertView setCenter:keyWindow.center]; 66 | umAlertView.layer.borderColor = [UIColor darkGrayColor].CGColor; 67 | umAlertView.backgroundColor = UM_ALERT_VIEW_ALL_BACKGROUND_COLOR; 68 | umAlertView.layer.borderWidth = 2.0f; 69 | umAlertView.layer.cornerRadius = 3 * UM_ALERT_VIEW_CORNER_RADIUS; 70 | umAlertView.clipsToBounds = YES; 71 | umAlertView.alpha = 0.0f; 72 | self.umAlertView = umAlertView; 73 | 74 | UILabel *alertTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(UM_ALERT_VIEW_MARGIN_ZERO,UM_ALERT_VIEW_MARGIN_ZERO, umAlertView.frame.size.width, UM_ALERT_VIEW_HEIGHT)]; 75 | [alertTitleLabel setText:title]; 76 | [alertTitleLabel setTextColor:UM_ALERT_VIEW_TITLE_TEXT_COLOR]; 77 | [alertTitleLabel setTextAlignment:NSTextAlignmentCenter]; 78 | [umAlertView addSubview:alertTitleLabel]; 79 | self.alertTitleLabel = alertTitleLabel; 80 | 81 | UIPickerView *dataPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(UM_ALERT_VIEW_MARGIN_ZERO, UM_ALERT_VIEW_HEIGHT, umAlertView.frame.size.width, UM_ALERT_VIEW_HEIGHT * 3)]; 82 | dataPicker.backgroundColor = UM_ALERT_VIEW_ALL_BACKGROUND_COLOR; 83 | dataPicker.delegate = self; 84 | dataPicker.dataSource = self; 85 | [umAlertView addSubview:dataPicker]; 86 | self.dataPicker = dataPicker; 87 | 88 | if(haveCancelButton) { 89 | [self addCancelButton]; 90 | NSLog(@"add"); 91 | } else { 92 | CGFloat umAlertViewWidth = self.umAlertView.frame.size.width; 93 | [self onlySelectButton:umAlertViewWidth]; 94 | } 95 | 96 | [keyWindow addSubview:self.umAlertView]; 97 | 98 | [UIView animateWithDuration:duration animations: ^{ 99 | NSLog(@"animation"); 100 | umAlertView.alpha = 1.0f; 101 | completed(); 102 | }]; 103 | 104 | 105 | } 106 | 107 | - (void)addCancelButton { 108 | 109 | CGFloat umAlertViewWidthDivide = self.umAlertView.frame.size.width / 2; 110 | [self onlySelectButton:umAlertViewWidthDivide]; 111 | 112 | UIButton *cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(self.selectButton.frame.size.width, self.alertTitleLabel.frame.size.height + self.dataPicker.frame.size.height, self.umAlertView.frame.size.width / 2, UM_ALERT_VIEW_HEIGHT)]; 113 | cancelButton.clipsToBounds = YES; 114 | [cancelButton setBackgroundColor:UM_ALERT_VIEW_SELECT_CANCEL_BUTTON_COLOR]; 115 | [cancelButton setTitle:UM_ALERT_VIEW_SELECT_CANCEL_BUTTON_TITLE forState:UIControlStateNormal]; 116 | [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 117 | [cancelButton addTarget:self action:@selector(alertCancelButtonAction) forControlEvents:UIControlEventTouchUpInside]; 118 | 119 | [self.umAlertView addSubview:cancelButton]; 120 | } 121 | 122 | - (void)onlySelectButton:(CGFloat) width { 123 | 124 | UIButton *selectButton = [[UIButton alloc] initWithFrame:CGRectMake(UM_ALERT_VIEW_MARGIN_ZERO, self.alertTitleLabel.frame.size.height + self.dataPicker.frame.size.height, width, UM_ALERT_VIEW_HEIGHT)]; 125 | selectButton.clipsToBounds = YES; 126 | [selectButton setBackgroundColor:UM_ALERT_VIEW_SELECT_BUTTON_COLOR]; 127 | [selectButton setTitle:UM_ALERT_VIEW_SELECT_BUTTON_TITLE forState:UIControlStateNormal]; 128 | [selectButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 129 | [selectButton addTarget:self action:@selector(alertButtonAction) forControlEvents:UIControlEventTouchUpInside]; 130 | self.selectButton = selectButton; 131 | 132 | [self.umAlertView addSubview:selectButton]; 133 | } 134 | 135 | - (void)um_dismissAlertView { 136 | 137 | [UIView animateWithDuration:duration animations:^{ 138 | NSLog(@"anmiation"); 139 | self.umAlertView.alpha = 0.0f; 140 | } completion:^(BOOL finished) { 141 | [self.umAlertView removeFromSuperview]; 142 | }]; 143 | 144 | } 145 | 146 | - (void)um_dismissAlertViewCompletion:(void(^)(void))complete { 147 | 148 | [UIView animateWithDuration:duration animations:^{ 149 | NSLog(@"anmiation"); 150 | self.umAlertView.alpha = 0.0f; 151 | } completion:^(BOOL finished) { 152 | [self.umAlertView removeFromSuperview]; 153 | complete(); 154 | }]; 155 | 156 | } 157 | 158 | - (UIView *)keyWindow { 159 | return [UIApplication sharedApplication].delegate.window; 160 | } 161 | 162 | // delegate 163 | - (void)alertButtonAction { 164 | NSLog(@"alertButtonAction"); 165 | 166 | if(!isScrollPickerView) { 167 | self.selectData = [pickerListData objectAtIndex:0]; 168 | } else { 169 | self.selectData = [pickerListData objectAtIndex:pickerRow]; 170 | } 171 | 172 | if ([self.delegate respondsToSelector:@selector(selectUMAlertButton)]) { 173 | [self.delegate selectUMAlertButton]; 174 | } 175 | } 176 | 177 | - (void)alertCancelButtonAction { 178 | NSLog(@"alertCancelButtonAction"); 179 | 180 | if ([self.delegate respondsToSelector:@selector(selectUMAlertCancelButton)]) { 181 | [self.delegate selectUMAlertCancelButton]; 182 | } 183 | } 184 | 185 | #pragma mark - Picker view data source 186 | 187 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { 188 | 189 | return 1; 190 | } 191 | 192 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { 193 | 194 | return [pickerListData count]; 195 | } 196 | 197 | - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { 198 | 199 | return [pickerListData objectAtIndex:row]; 200 | } 201 | 202 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { 203 | 204 | isScrollPickerView = YES; 205 | pickerRow = row; 206 | 207 | } 208 | 209 | @end 210 | -------------------------------------------------------------------------------- /UMAlertView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /UMAlertView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UMAlertView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic) UMAlertView *umAlertView; 15 | @property (nonatomic, weak) IBOutlet UILabel *dataLabel; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | self.umAlertView = [[UMAlertView alloc] init]; 26 | self.umAlertView.delegate = self; 27 | 28 | } 29 | 30 | - (IBAction)showUMAlertView:(id)sender { 31 | [self.dataLabel setHidden:YES]; 32 | NSArray *array = [[NSArray alloc] initWithObjects:@"UMData1", @"UMData2", @"UMData3", @"UMData4", @"UMData5", nil]; 33 | [self.umAlertView um_showAlertViewTitle:@"UMAlertView" pickerData:array haveCancelButton:YES completion:^{ 34 | NSLog(@"UMAlertView show success"); 35 | }]; 36 | 37 | } 38 | 39 | - (void)selectUMAlertButton { 40 | [self.dataLabel setHidden:NO]; 41 | NSLog(@"ViewController Show Data : %@", [self.umAlertView selectData]); 42 | [self.dataLabel setText:[self.umAlertView selectData]]; 43 | [self.umAlertView um_dismissAlertViewCompletion:^{ 44 | NSLog(@"UMAlertView dismiss success"); 45 | }]; 46 | 47 | } 48 | 49 | - (void)selectUMAlertCancelButton { 50 | 51 | [self.umAlertView um_dismissAlertView]; 52 | 53 | } 54 | 55 | - (void)didReceiveMemoryWarning { 56 | [super didReceiveMemoryWarning]; 57 | // Dispose of any resources that can be recreated. 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /UMAlertView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UMAlertView 4 | // 5 | // Created by Jyo on 2016. 7. 22.. 6 | // Copyright © 2016년 Jyo. 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 | --------------------------------------------------------------------------------