├── README.md ├── RGButton.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── RGButton.xccheckout │ └── xcuserdata │ │ └── roberageleta.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── roberageleta.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── RGButton.xcscheme │ └── xcschememanagement.plist ├── RGButton ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── collapse-50.imageset │ │ ├── Contents.json │ │ └── collapse-50.png │ ├── dropbox_copyrighted-50.imageset │ │ ├── Contents.json │ │ └── dropbox_copyrighted-50.png │ ├── facebook-50.imageset │ │ ├── Contents.json │ │ └── facebook-50.png │ ├── foursquare-50.imageset │ │ ├── Contents.json │ │ └── foursquare-50.png │ ├── google_plus-50.imageset │ │ ├── Contents.json │ │ └── google_plus-50.png │ ├── magnet-50.imageset │ │ ├── Contents.json │ │ └── magnet-50.png │ ├── plus.imageset │ │ ├── Contents.json │ │ └── plus.png │ └── twitter-50.imageset │ │ ├── Contents.json │ │ └── twitter-50.png ├── Info.plist ├── RGButton.h ├── RGButton.m ├── ViewController.h ├── ViewController.m └── main.m ├── RGButtonTests ├── Info.plist └── RGButtonTests.m └── http---makeagif.com--media-1-11-2015-QUePcw.gif /README.md: -------------------------------------------------------------------------------- 1 | # RGButton 2 | [Check it out live](https://www.youtube.com/watch?v=RN47kjgtbhA&feature=youtu.be) 3 | 4 | Custom Button when tapped displays an set of 5 buttons moving radially out . Inspired by myfitnesspal 5 | 6 | Implement the RGButtonDelegateProtocol 7 | with the following method (it let's you know which button was tapped,the 0th index is left most button 8 | - (void)tappedButtonWithIndex:(NSInteger )index; 9 | 10 | #configuration 11 | 12 | - (void)setRadius:(CGFloat )radiusSet;//how far out the buttons move out 13 | - (void)setImagesForButtons:(NSArray *)imageArray; 14 | - (void)setCenterButtonImage:(UIImage *)setimage backgroundColor:(UIColor *)color; 15 | - (void)backGroundColor:(UIColor *)color; 16 | 17 | 18 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A1E607E21A62030400FE3882 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E607E11A62030400FE3882 /* main.m */; }; 11 | A1E607E51A62030400FE3882 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E607E41A62030400FE3882 /* AppDelegate.m */; }; 12 | A1E607E81A62030400FE3882 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E607E71A62030400FE3882 /* ViewController.m */; }; 13 | A1E607EB1A62030400FE3882 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A1E607E91A62030400FE3882 /* Main.storyboard */; }; 14 | A1E607ED1A62030400FE3882 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1E607EC1A62030400FE3882 /* Images.xcassets */; }; 15 | A1E607F01A62030400FE3882 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1E607EE1A62030400FE3882 /* LaunchScreen.xib */; }; 16 | A1E607FC1A62030400FE3882 /* RGButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E607FB1A62030400FE3882 /* RGButtonTests.m */; }; 17 | A1E608071A6203CA00FE3882 /* RGButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E608061A6203CA00FE3882 /* RGButton.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | A1E607F61A62030400FE3882 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = A1E607D41A62030300FE3882 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = A1E607DB1A62030400FE3882; 26 | remoteInfo = RGButton; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | A1E607DC1A62030400FE3882 /* RGButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RGButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | A1E607E01A62030400FE3882 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | A1E607E11A62030400FE3882 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | A1E607E31A62030400FE3882 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | A1E607E41A62030400FE3882 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | A1E607E61A62030400FE3882 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 37 | A1E607E71A62030400FE3882 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 38 | A1E607EA1A62030400FE3882 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | A1E607EC1A62030400FE3882 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | A1E607EF1A62030400FE3882 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | A1E607F51A62030400FE3882 /* RGButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RGButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | A1E607FA1A62030400FE3882 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | A1E607FB1A62030400FE3882 /* RGButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RGButtonTests.m; sourceTree = ""; }; 44 | A1E608051A6203CA00FE3882 /* RGButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RGButton.h; sourceTree = ""; }; 45 | A1E608061A6203CA00FE3882 /* RGButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RGButton.m; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | A1E607D91A62030400FE3882 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | A1E607F21A62030400FE3882 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | A1E607D31A62030300FE3882 = { 67 | isa = PBXGroup; 68 | children = ( 69 | A1E607DE1A62030400FE3882 /* RGButton */, 70 | A1E607F81A62030400FE3882 /* RGButtonTests */, 71 | A1E607DD1A62030400FE3882 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | A1E607DD1A62030400FE3882 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | A1E607DC1A62030400FE3882 /* RGButton.app */, 79 | A1E607F51A62030400FE3882 /* RGButtonTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | A1E607DE1A62030400FE3882 /* RGButton */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | A1E607E31A62030400FE3882 /* AppDelegate.h */, 88 | A1E607E41A62030400FE3882 /* AppDelegate.m */, 89 | A1E607E61A62030400FE3882 /* ViewController.h */, 90 | A1E607E71A62030400FE3882 /* ViewController.m */, 91 | A1E607E91A62030400FE3882 /* Main.storyboard */, 92 | A1E608051A6203CA00FE3882 /* RGButton.h */, 93 | A1E608061A6203CA00FE3882 /* RGButton.m */, 94 | A1E607EC1A62030400FE3882 /* Images.xcassets */, 95 | A1E607EE1A62030400FE3882 /* LaunchScreen.xib */, 96 | A1E607DF1A62030400FE3882 /* Supporting Files */, 97 | ); 98 | path = RGButton; 99 | sourceTree = ""; 100 | }; 101 | A1E607DF1A62030400FE3882 /* Supporting Files */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | A1E607E01A62030400FE3882 /* Info.plist */, 105 | A1E607E11A62030400FE3882 /* main.m */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | A1E607F81A62030400FE3882 /* RGButtonTests */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | A1E607FB1A62030400FE3882 /* RGButtonTests.m */, 114 | A1E607F91A62030400FE3882 /* Supporting Files */, 115 | ); 116 | path = RGButtonTests; 117 | sourceTree = ""; 118 | }; 119 | A1E607F91A62030400FE3882 /* Supporting Files */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | A1E607FA1A62030400FE3882 /* Info.plist */, 123 | ); 124 | name = "Supporting Files"; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | A1E607DB1A62030400FE3882 /* RGButton */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = A1E607FF1A62030400FE3882 /* Build configuration list for PBXNativeTarget "RGButton" */; 133 | buildPhases = ( 134 | A1E607D81A62030400FE3882 /* Sources */, 135 | A1E607D91A62030400FE3882 /* Frameworks */, 136 | A1E607DA1A62030400FE3882 /* Resources */, 137 | ); 138 | buildRules = ( 139 | ); 140 | dependencies = ( 141 | ); 142 | name = RGButton; 143 | productName = RGButton; 144 | productReference = A1E607DC1A62030400FE3882 /* RGButton.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | A1E607F41A62030400FE3882 /* RGButtonTests */ = { 148 | isa = PBXNativeTarget; 149 | buildConfigurationList = A1E608021A62030400FE3882 /* Build configuration list for PBXNativeTarget "RGButtonTests" */; 150 | buildPhases = ( 151 | A1E607F11A62030400FE3882 /* Sources */, 152 | A1E607F21A62030400FE3882 /* Frameworks */, 153 | A1E607F31A62030400FE3882 /* Resources */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | A1E607F71A62030400FE3882 /* PBXTargetDependency */, 159 | ); 160 | name = RGButtonTests; 161 | productName = RGButtonTests; 162 | productReference = A1E607F51A62030400FE3882 /* RGButtonTests.xctest */; 163 | productType = "com.apple.product-type.bundle.unit-test"; 164 | }; 165 | /* End PBXNativeTarget section */ 166 | 167 | /* Begin PBXProject section */ 168 | A1E607D41A62030300FE3882 /* Project object */ = { 169 | isa = PBXProject; 170 | attributes = { 171 | LastUpgradeCheck = 0610; 172 | ORGANIZATIONNAME = "ROBERA GELETA"; 173 | TargetAttributes = { 174 | A1E607DB1A62030400FE3882 = { 175 | CreatedOnToolsVersion = 6.1.1; 176 | }; 177 | A1E607F41A62030400FE3882 = { 178 | CreatedOnToolsVersion = 6.1.1; 179 | TestTargetID = A1E607DB1A62030400FE3882; 180 | }; 181 | }; 182 | }; 183 | buildConfigurationList = A1E607D71A62030300FE3882 /* Build configuration list for PBXProject "RGButton" */; 184 | compatibilityVersion = "Xcode 3.2"; 185 | developmentRegion = English; 186 | hasScannedForEncodings = 0; 187 | knownRegions = ( 188 | en, 189 | Base, 190 | ); 191 | mainGroup = A1E607D31A62030300FE3882; 192 | productRefGroup = A1E607DD1A62030400FE3882 /* Products */; 193 | projectDirPath = ""; 194 | projectRoot = ""; 195 | targets = ( 196 | A1E607DB1A62030400FE3882 /* RGButton */, 197 | A1E607F41A62030400FE3882 /* RGButtonTests */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | A1E607DA1A62030400FE3882 /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | A1E607EB1A62030400FE3882 /* Main.storyboard in Resources */, 208 | A1E607F01A62030400FE3882 /* LaunchScreen.xib in Resources */, 209 | A1E607ED1A62030400FE3882 /* Images.xcassets in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | A1E607F31A62030400FE3882 /* Resources */ = { 214 | isa = PBXResourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | A1E607D81A62030400FE3882 /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | A1E607E81A62030400FE3882 /* ViewController.m in Sources */, 228 | A1E607E51A62030400FE3882 /* AppDelegate.m in Sources */, 229 | A1E608071A6203CA00FE3882 /* RGButton.m in Sources */, 230 | A1E607E21A62030400FE3882 /* main.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | A1E607F11A62030400FE3882 /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | A1E607FC1A62030400FE3882 /* RGButtonTests.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXTargetDependency section */ 245 | A1E607F71A62030400FE3882 /* PBXTargetDependency */ = { 246 | isa = PBXTargetDependency; 247 | target = A1E607DB1A62030400FE3882 /* RGButton */; 248 | targetProxy = A1E607F61A62030400FE3882 /* PBXContainerItemProxy */; 249 | }; 250 | /* End PBXTargetDependency section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | A1E607E91A62030400FE3882 /* Main.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | A1E607EA1A62030400FE3882 /* Base */, 257 | ); 258 | name = Main.storyboard; 259 | sourceTree = ""; 260 | }; 261 | A1E607EE1A62030400FE3882 /* LaunchScreen.xib */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | A1E607EF1A62030400FE3882 /* Base */, 265 | ); 266 | name = LaunchScreen.xib; 267 | sourceTree = ""; 268 | }; 269 | /* End PBXVariantGroup section */ 270 | 271 | /* Begin XCBuildConfiguration section */ 272 | A1E607FD1A62030400FE3882 /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ALWAYS_SEARCH_USER_PATHS = NO; 276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 277 | CLANG_CXX_LIBRARY = "libc++"; 278 | CLANG_ENABLE_MODULES = YES; 279 | CLANG_ENABLE_OBJC_ARC = YES; 280 | CLANG_WARN_BOOL_CONVERSION = YES; 281 | CLANG_WARN_CONSTANT_CONVERSION = YES; 282 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 290 | COPY_PHASE_STRIP = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_DYNAMIC_NO_PIC = NO; 294 | GCC_OPTIMIZATION_LEVEL = 0; 295 | GCC_PREPROCESSOR_DEFINITIONS = ( 296 | "DEBUG=1", 297 | "$(inherited)", 298 | ); 299 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 307 | MTL_ENABLE_DEBUG_INFO = YES; 308 | ONLY_ACTIVE_ARCH = YES; 309 | SDKROOT = iphoneos; 310 | }; 311 | name = Debug; 312 | }; 313 | A1E607FE1A62030400FE3882 /* Release */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = YES; 332 | ENABLE_NS_ASSERTIONS = NO; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | GCC_C_LANGUAGE_STANDARD = gnu99; 335 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 336 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 337 | GCC_WARN_UNDECLARED_SELECTOR = YES; 338 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 339 | GCC_WARN_UNUSED_FUNCTION = YES; 340 | GCC_WARN_UNUSED_VARIABLE = YES; 341 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 342 | MTL_ENABLE_DEBUG_INFO = NO; 343 | SDKROOT = iphoneos; 344 | VALIDATE_PRODUCT = YES; 345 | }; 346 | name = Release; 347 | }; 348 | A1E608001A62030400FE3882 /* Debug */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 352 | CODE_SIGN_IDENTITY = ""; 353 | INFOPLIST_FILE = RGButton/Info.plist; 354 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | }; 357 | name = Debug; 358 | }; 359 | A1E608011A62030400FE3882 /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 363 | INFOPLIST_FILE = RGButton/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Release; 368 | }; 369 | A1E608031A62030400FE3882 /* Debug */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | BUNDLE_LOADER = "$(TEST_HOST)"; 373 | FRAMEWORK_SEARCH_PATHS = ( 374 | "$(SDKROOT)/Developer/Library/Frameworks", 375 | "$(inherited)", 376 | ); 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | INFOPLIST_FILE = RGButtonTests/Info.plist; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RGButton.app/RGButton"; 385 | }; 386 | name = Debug; 387 | }; 388 | A1E608041A62030400FE3882 /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | BUNDLE_LOADER = "$(TEST_HOST)"; 392 | FRAMEWORK_SEARCH_PATHS = ( 393 | "$(SDKROOT)/Developer/Library/Frameworks", 394 | "$(inherited)", 395 | ); 396 | INFOPLIST_FILE = RGButtonTests/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RGButton.app/RGButton"; 400 | }; 401 | name = Release; 402 | }; 403 | /* End XCBuildConfiguration section */ 404 | 405 | /* Begin XCConfigurationList section */ 406 | A1E607D71A62030300FE3882 /* Build configuration list for PBXProject "RGButton" */ = { 407 | isa = XCConfigurationList; 408 | buildConfigurations = ( 409 | A1E607FD1A62030400FE3882 /* Debug */, 410 | A1E607FE1A62030400FE3882 /* Release */, 411 | ); 412 | defaultConfigurationIsVisible = 0; 413 | defaultConfigurationName = Release; 414 | }; 415 | A1E607FF1A62030400FE3882 /* Build configuration list for PBXNativeTarget "RGButton" */ = { 416 | isa = XCConfigurationList; 417 | buildConfigurations = ( 418 | A1E608001A62030400FE3882 /* Debug */, 419 | A1E608011A62030400FE3882 /* Release */, 420 | ); 421 | defaultConfigurationIsVisible = 0; 422 | defaultConfigurationName = Release; 423 | }; 424 | A1E608021A62030400FE3882 /* Build configuration list for PBXNativeTarget "RGButtonTests" */ = { 425 | isa = XCConfigurationList; 426 | buildConfigurations = ( 427 | A1E608031A62030400FE3882 /* Debug */, 428 | A1E608041A62030400FE3882 /* Release */, 429 | ); 430 | defaultConfigurationIsVisible = 0; 431 | defaultConfigurationName = Release; 432 | }; 433 | /* End XCConfigurationList section */ 434 | }; 435 | rootObject = A1E607D41A62030300FE3882 /* Project object */; 436 | } 437 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/project.xcworkspace/xcshareddata/RGButton.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 2883E735-86B5-4E49-B6EC-B2931B31A78A 9 | IDESourceControlProjectName 10 | RGButton 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | F5D22AC805699AF60BD6CE536C39BD9489FCD93E 14 | https://github.com/terminatorover/RGButton.git 15 | 16 | IDESourceControlProjectPath 17 | RGButton.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | F5D22AC805699AF60BD6CE536C39BD9489FCD93E 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/terminatorover/RGButton.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | F5D22AC805699AF60BD6CE536C39BD9489FCD93E 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | F5D22AC805699AF60BD6CE536C39BD9489FCD93E 36 | IDESourceControlWCCName 37 | RGButton 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/project.xcworkspace/xcuserdata/roberageleta.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton.xcodeproj/project.xcworkspace/xcuserdata/roberageleta.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RGButton.xcodeproj/xcuserdata/roberageleta.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 104 | 116 | 117 | 118 | 120 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/xcuserdata/roberageleta.xcuserdatad/xcschemes/RGButton.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /RGButton.xcodeproj/xcuserdata/roberageleta.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RGButton.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A1E607DB1A62030400FE3882 16 | 17 | primary 18 | 19 | 20 | A1E607F41A62030400FE3882 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RGButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. 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 | -------------------------------------------------------------------------------- /RGButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. 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 | -------------------------------------------------------------------------------- /RGButton/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 | -------------------------------------------------------------------------------- /RGButton/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /RGButton/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 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/collapse-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "collapse-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/collapse-50.imageset/collapse-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/collapse-50.imageset/collapse-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/dropbox_copyrighted-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "dropbox_copyrighted-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/dropbox_copyrighted-50.imageset/dropbox_copyrighted-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/dropbox_copyrighted-50.imageset/dropbox_copyrighted-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/facebook-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "facebook-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/facebook-50.imageset/facebook-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/facebook-50.imageset/facebook-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/foursquare-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "foursquare-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/foursquare-50.imageset/foursquare-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/foursquare-50.imageset/foursquare-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/google_plus-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "google_plus-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/google_plus-50.imageset/google_plus-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/google_plus-50.imageset/google_plus-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/magnet-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "magnet-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/magnet-50.imageset/magnet-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/magnet-50.imageset/magnet-50.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/plus.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "plus.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/plus.imageset/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/plus.imageset/plus.png -------------------------------------------------------------------------------- /RGButton/Images.xcassets/twitter-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "twitter-50.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RGButton/Images.xcassets/twitter-50.imageset/twitter-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/RGButton/Images.xcassets/twitter-50.imageset/twitter-50.png -------------------------------------------------------------------------------- /RGButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | EnterWithBoldness.$(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 | -------------------------------------------------------------------------------- /RGButton/RGButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // RGButton.h 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RGButton : UIView 12 | 13 | - (void)setRadius:(CGFloat )radiusSet; 14 | //--> allows you to set the images of the buttons. the 0th index is left most button 15 | - (void)setImagesForButtons:(NSArray *)imageArray; 16 | 17 | - (void)setCenterButtonImage:(UIImage *)setimage backgroundColor:(UIColor *)color; 18 | //---> color of the shade that goes over the scene that the user sees(by default RED) 19 | - (void)backGroundColor:(UIColor *)color; 20 | @property id delegate; 21 | @end 22 | 23 | 24 | @protocol RGButtonDelegateProtocol 25 | - (void)tappedButtonWithIndex:(NSInteger )index; 26 | @end -------------------------------------------------------------------------------- /RGButton/RGButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // RGButton.m 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. All rights reserved. 7 | // 8 | 9 | #import "RGButton.h" 10 | 11 | @implementation RGButton 12 | { 13 | UIButton *b1; 14 | UIButton *b2; 15 | UIButton *b3; 16 | UIButton *b4; 17 | UIButton *b5; 18 | UIWindow *mainWindow; 19 | UITapGestureRecognizer *tapRecognizer ; 20 | UIView *darkerView; 21 | 22 | //setup for final locations of the buttons 23 | CGFloat radius; 24 | CGPoint position1; 25 | CGPoint position2; 26 | CGPoint position3; 27 | CGPoint position4; 28 | CGPoint position5; 29 | 30 | CGPoint centerPoint; 31 | 32 | CGSize size; 33 | BOOL tapped; 34 | 35 | //---> 36 | UIImage *image; 37 | UIImageView *imageView; 38 | 39 | //---> 40 | BOOL firstTime; 41 | 42 | } 43 | /* 44 | // Only override drawRect: if you perform custom drawing. 45 | // An empty implementation adversely affects performance during animation. 46 | - (void)drawRect:(CGRect)rect { 47 | // Drawing code 48 | } 49 | */ 50 | 51 | - (id)initWithCoder:(NSCoder *)aDecoder 52 | { 53 | self = [super initWithCoder:aDecoder]; 54 | if(self) 55 | { 56 | [self setUpViewHierrachy]; 57 | [self setUpGestureRecognition]; 58 | } 59 | return self; 60 | } 61 | 62 | - (instancetype)initWithFrame:(CGRect)frame 63 | { 64 | self = [super initWithFrame:frame]; 65 | if(self) 66 | { 67 | [self setUpViewHierrachy]; 68 | [self setUpGestureRecognition]; 69 | } 70 | return self; 71 | } 72 | 73 | - (void)setUpViewHierrachy 74 | { 75 | tapped = NO; 76 | CGSize buttonSize = self.bounds.size; 77 | //--> get the window 78 | mainWindow = (UIWindow *)[UIApplication sharedApplication].windows [0]; 79 | //Point in the window 80 | 81 | centerPoint = [mainWindow convertPoint:self.center fromView:self.superview]; 82 | centerPoint = CGPointMake(centerPoint.x - (self.bounds.size.width/4) , centerPoint.y - (self.bounds.size.width/2)); 83 | NSLog(@"Center Point: %@",NSStringFromCGPoint(centerPoint)); 84 | 85 | b1 = [[UIButton alloc]initWithFrame:CGRectMake(centerPoint.x, centerPoint.y, 0, 0)]; 86 | b2 = [[UIButton alloc]initWithFrame:CGRectMake(centerPoint.x, centerPoint.y, 0, 0)]; 87 | b3 = [[UIButton alloc]initWithFrame:CGRectMake(centerPoint.x, centerPoint.y, 0, 0)]; 88 | b4 = [[UIButton alloc]initWithFrame:CGRectMake(centerPoint.x, centerPoint.y, 0, 0)]; 89 | b5 = [[UIButton alloc]initWithFrame:CGRectMake(centerPoint.x, centerPoint.y, 0, 0)]; 90 | 91 | 92 | [b1 addTarget:self action:@selector(button1) forControlEvents:UIControlEventTouchUpInside]; 93 | [b2 addTarget:self action:@selector(button2) forControlEvents:UIControlEventTouchUpInside]; 94 | [b3 addTarget:self action:@selector(button3) forControlEvents:UIControlEventTouchUpInside]; 95 | [b4 addTarget:self action:@selector(button4) forControlEvents:UIControlEventTouchUpInside]; 96 | [b5 addTarget:self action:@selector(button5) forControlEvents:UIControlEventTouchUpInside]; 97 | 98 | 99 | 100 | [self visibility:NO]; 101 | [self makeTheViewsCircular]; 102 | darkerView = [[UIView alloc]initWithFrame:mainWindow.bounds]; 103 | darkerView.backgroundColor = [UIColor redColor]; 104 | darkerView.alpha = .7; 105 | darkerView.userInteractionEnabled = NO; 106 | radius = 170; 107 | 108 | 109 | position1 = CGPointMake(centerPoint.x + radius * cos(M_PI/6), centerPoint.y - radius* sin(M_PI/6)); 110 | position2 = CGPointMake(centerPoint.x + radius * cos(M_PI/3),centerPoint.y - radius* sin(M_PI/3)); 111 | position3 = CGPointMake(centerPoint.x + radius * cos(M_PI/2), centerPoint.y - radius* sin(M_PI/2)); 112 | position4 = CGPointMake(centerPoint.x + radius * cos(2 * M_PI/3),centerPoint.y - radius* sin(2 * M_PI/3)); 113 | position5 = CGPointMake(centerPoint.x + radius * cos(5 * M_PI/6),centerPoint.y - radius* sin(5 * M_PI/6)); 114 | 115 | size = CGSizeMake(self.bounds.size.width/1.5,self.bounds.size.height/1.5); 116 | 117 | 118 | imageView = [[UIImageView alloc]initWithFrame:self.bounds]; 119 | [self addSubview:imageView]; 120 | imageView.layer.masksToBounds = YES; 121 | imageView.layer.cornerRadius = imageView.layer.bounds.size.width /2; 122 | self.layer.cornerRadius = self.layer.bounds.size.width/2; 123 | 124 | } 125 | 126 | - (void)setUpGestureRecognition 127 | { 128 | tapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapped:)]; 129 | [self addGestureRecognizer:tapRecognizer]; 130 | } 131 | 132 | #pragma mark - Circle 133 | - (void)makeLayerCircular:(CALayer *)layer 134 | { 135 | layer.cornerRadius = layer.bounds.size.width /4 ; 136 | 137 | } 138 | 139 | - (void)makeTheViewsCircular 140 | { 141 | [self makeLayerCircular:b1.layer]; 142 | [self makeLayerCircular:b2.layer]; 143 | [self makeLayerCircular:b3.layer]; 144 | [self makeLayerCircular:b4.layer]; 145 | [self makeLayerCircular:b5.layer]; 146 | } 147 | 148 | 149 | #pragma mark - Tap Gesture 150 | - (void)tapped:(UITapGestureRecognizer *)sender 151 | { 152 | [self animate]; 153 | } 154 | 155 | 156 | #pragma mark - Positions 157 | - (void)moveView:(BOOL)move 158 | { 159 | if(move)//move the views out 160 | { 161 | [mainWindow addSubview:darkerView]; 162 | [mainWindow addSubview:b1]; 163 | [mainWindow addSubview:b2]; 164 | [mainWindow addSubview:b3]; 165 | [mainWindow addSubview:b4]; 166 | [mainWindow addSubview:b5]; 167 | [self visibility:YES]; 168 | 169 | 170 | b1.frame = CGRectMake(position1.x, position1.y, size.width, size.height); 171 | b2.frame = CGRectMake(position2.x, position2.y, size.width, size.height); 172 | b3.frame = CGRectMake(position3.x, position3.y, size.width, size.height); 173 | b4.frame = CGRectMake(position4.x, position4.y, size.width, size.height); 174 | b5.frame = CGRectMake(position5.x, position5.y, size.width, size.height); 175 | 176 | 177 | CGAffineTransform currentTransform = self.transform; 178 | CGAffineTransform newTransform = CGAffineTransformRotate(currentTransform, M_PI/2); 179 | self.transform = newTransform; 180 | 181 | } 182 | else//move the views to the center 183 | { 184 | [UIView animateWithDuration:.5 animations:^{ 185 | CGAffineTransform identityTransform = CGAffineTransformIdentity; 186 | self.transform = identityTransform; 187 | b1.frame = CGRectMake(centerPoint.x, centerPoint.y,self.bounds.size.width/2, self.bounds.size.width/2); 188 | b2.frame = CGRectMake(centerPoint.x, centerPoint.y,self.bounds.size.width/2, self.bounds.size.width/2); 189 | b3.frame = CGRectMake(centerPoint.x, centerPoint.y,self.bounds.size.width/2, self.bounds.size.width/2); 190 | b4.frame = CGRectMake(centerPoint.x, centerPoint.y,self.bounds.size.width/2, self.bounds.size.width/2); 191 | b5.frame = CGRectMake(centerPoint.x, centerPoint.y,self.bounds.size.width/2, self.bounds.size.width/2); 192 | darkerView.alpha = 0.0; 193 | [self visibility:NO]; 194 | } completion:^(BOOL finished) { 195 | [self visibility:YES]; 196 | [darkerView removeFromSuperview]; 197 | [b1 removeFromSuperview]; 198 | [b2 removeFromSuperview]; 199 | [b3 removeFromSuperview]; 200 | [b4 removeFromSuperview]; 201 | [b5 removeFromSuperview]; 202 | darkerView.alpha = 0.5; 203 | 204 | }]; 205 | 206 | 207 | 208 | NSLog(@"Center Point1: %@",NSStringFromCGPoint(centerPoint)); 209 | } 210 | } 211 | 212 | 213 | 214 | #pragma mark - Inivisible 215 | - (void)visibility:(BOOL)visible 216 | { 217 | if(!visible) 218 | { 219 | b1.alpha = 0.0; 220 | b2.alpha = 0.0; 221 | b3.alpha = 0.0; 222 | b4.alpha = 0.0; 223 | b4.alpha = 0.0; 224 | b5.alpha = 0.0; 225 | } 226 | else 227 | { 228 | b1.alpha = 1.0; 229 | b2.alpha = 1.0; 230 | b3.alpha = 1.0; 231 | b4.alpha = 1.0; 232 | b4.alpha = 1.0; 233 | b5.alpha = 1.0; 234 | 235 | } 236 | } 237 | 238 | 239 | - (void)recomputePositions 240 | { 241 | position1 = CGPointMake(centerPoint.x + radius * cos(M_PI/6), centerPoint.y - radius* sin(M_PI/6)); 242 | position2 = CGPointMake(centerPoint.x + radius * cos(M_PI/3),centerPoint.y - radius* sin(M_PI/3)); 243 | position3 = CGPointMake(centerPoint.x + radius * cos(M_PI/2), centerPoint.y - radius* sin(M_PI/2)); 244 | position4 = CGPointMake(centerPoint.x + radius * cos(2 * M_PI/3),centerPoint.y - radius* sin(2 * M_PI/3)); 245 | position5 = CGPointMake(centerPoint.x + radius * cos(5 * M_PI/6),centerPoint.y - radius* sin(5 * M_PI/6)); 246 | } 247 | 248 | #pragma mark - Configuration 249 | #pragma mark - Setting size of the view 250 | - (void)setSize:(CGSize )buttonSize 251 | { 252 | size = buttonSize; 253 | } 254 | 255 | - (void)setRadius:(CGFloat )radiusSet 256 | { 257 | radius = radiusSet; 258 | [self recomputePositions]; 259 | } 260 | 261 | 262 | #pragma mark - 263 | 264 | - (void)button1 265 | { 266 | [self animate]; 267 | if(_delegate && [_delegate respondsToSelector:@selector(tappedButtonWithIndex:)]) 268 | { 269 | [_delegate tappedButtonWithIndex:1]; 270 | } 271 | } 272 | 273 | - (void)button2 274 | { 275 | [self animate]; 276 | if(_delegate && [_delegate respondsToSelector:@selector(tappedButtonWithIndex:)]) 277 | { 278 | [_delegate tappedButtonWithIndex:2]; 279 | } 280 | } 281 | 282 | - (void)button3 283 | { 284 | [self animate]; 285 | if(_delegate && [_delegate respondsToSelector:@selector(tappedButtonWithIndex:)]) 286 | { 287 | [_delegate tappedButtonWithIndex:3]; 288 | } 289 | } 290 | 291 | - (void)button4 292 | { 293 | [self animate]; 294 | if(_delegate && [_delegate respondsToSelector:@selector(tappedButtonWithIndex:)]) 295 | { 296 | [_delegate tappedButtonWithIndex:4]; 297 | } 298 | } 299 | 300 | - (void)button5 301 | { 302 | [self animate]; 303 | if(_delegate && [_delegate respondsToSelector:@selector(tappedButtonWithIndex:)]) 304 | { 305 | [_delegate tappedButtonWithIndex:5]; 306 | } 307 | } 308 | 309 | 310 | #pragma mark - Animations 311 | - (void)animate 312 | { 313 | [UIView animateWithDuration:0.7 314 | delay:0 315 | usingSpringWithDamping:0.5 316 | initialSpringVelocity:0 317 | options:0 318 | animations:^{ 319 | 320 | [self moveView:!tapped]; 321 | tapped = !tapped; 322 | } completion:^(BOOL finished) { 323 | 324 | }]; 325 | } 326 | 327 | - (void)layoutSubviews 328 | { 329 | [super layoutSubviews]; 330 | centerPoint = [mainWindow convertPoint:self.center fromView:self.superview]; 331 | centerPoint = CGPointMake(centerPoint.x - (self.bounds.size.width/4) , centerPoint.y - (self.bounds.size.width/2)); 332 | 333 | [self recomputePositions]; 334 | [darkerView setFrame:mainWindow.bounds]; 335 | 336 | 337 | 338 | } 339 | 340 | 341 | - (void)setImagesForButtons:(NSArray *)imageArray 342 | { 343 | 344 | [b1 setImage:imageArray[0] forState:UIControlStateNormal]; 345 | [b2 setImage:imageArray[1] forState:UIControlStateNormal]; 346 | [b3 setImage:imageArray[2] forState:UIControlStateNormal]; 347 | [b4 setImage:imageArray[3] forState:UIControlStateNormal]; 348 | [b5 setImage:imageArray[4] forState:UIControlStateNormal]; 349 | } 350 | 351 | 352 | - (void)setCenterButtonImage:(UIImage *)setimage backgroundColor:(UIColor *)color; 353 | { 354 | imageView.image = setimage; 355 | self.backgroundColor = color; 356 | } 357 | 358 | - (void)backGroundColor:(UIColor *)color 359 | { 360 | darkerView.backgroundColor = color; 361 | } 362 | @end 363 | -------------------------------------------------------------------------------- /RGButton/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /RGButton/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. All rights reserved. 7 | // 8 | #import "RGButton.h" 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | @property (weak, nonatomic) IBOutlet RGButton *customButton; 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | UIImage *i1 = [UIImage imageNamed:@"dropbox_copyrighted-50"]; 22 | UIImage *i2 = [UIImage imageNamed:@"facebook-50"]; 23 | UIImage *i3 = [UIImage imageNamed:@"foursquare-50"]; 24 | UIImage *i4 = [UIImage imageNamed:@"google_plus-50"]; 25 | UIImage *i5 = [UIImage imageNamed:@"twitter-50"]; 26 | NSArray *listOfImages = @[i1,i2,i3,i4,i5]; 27 | [self.customButton setImagesForButtons:listOfImages]; 28 | [self.customButton setCenterButtonImage:[UIImage imageNamed:@"collapse-50"] backgroundColor:[UIColor greenColor]]; 29 | [self.customButton setRadius:130 ]; 30 | 31 | } 32 | 33 | - (void)viewWillAppear:(BOOL)animated 34 | { 35 | [super viewWillAppear:YES]; 36 | 37 | } 38 | - (void)didReceiveMemoryWarning { 39 | [super didReceiveMemoryWarning]; 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /RGButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RGButton 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. 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 | -------------------------------------------------------------------------------- /RGButtonTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | EnterWithBoldness.$(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 | -------------------------------------------------------------------------------- /RGButtonTests/RGButtonTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RGButtonTests.m 3 | // RGButtonTests 4 | // 5 | // Created by ROBERA GELETA on 1/10/15. 6 | // Copyright (c) 2015 ROBERA GELETA. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface RGButtonTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation RGButtonTests 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 | -------------------------------------------------------------------------------- /http---makeagif.com--media-1-11-2015-QUePcw.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/terminatorover/RGButton/c0750016e812adc50f19e0395a675a3009e47667/http---makeagif.com--media-1-11-2015-QUePcw.gif --------------------------------------------------------------------------------