diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e467357 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Victor Baro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Podfile b/Podfile index 7a2a10b..35d93e4 100644 --- a/Podfile +++ b/Podfile @@ -1,3 +1,4 @@ platform :ios, '7.0' + pod 'UIColor+FlatColors' pod 'pop' \ No newline at end of file diff --git a/VBFPopFlatButton.podspec b/VBFPopFlatButton.podspec new file mode 100644 index 0000000..b4e9c4b --- /dev/null +++ b/VBFPopFlatButton.podspec @@ -0,0 +1,25 @@ +Pod::Spec.new do |s| + + s.name = 'VBFPopFlatButton' + s.version = '0.0.1' + s.summary = 'Animated flat button using POP' + s.homepage = 'https://github.com/iBaro/VBFPopFlatButton' + s.license = { + :type => 'MIT', + :file => 'LICENSE' + } + s.author = { + 'Victor Baro' => 'dev.vbaro@gmail.com' + } + s.source = { + :git => 'https://github.com/iBaro/VBFPopFlatButton.git', + :tag => s.version.to_s + } + s.source_files = 'VBFPopFlatButton/VBFPopFlatButtonClasses/*.{m,h}' + s.requires_arc = true + s.dependency 'pop' + s.dependency 'UIColor+FlatColors' + s.platform = :ios, '7.0' + + +end diff --git a/VBFPopFlatButton.xcodeproj/project.pbxproj b/VBFPopFlatButton.xcodeproj/project.pbxproj index b89142d..ac64904 100644 --- a/VBFPopFlatButton.xcodeproj/project.pbxproj +++ b/VBFPopFlatButton.xcodeproj/project.pbxproj @@ -8,12 +8,12 @@ /* Begin PBXBuildFile section */ 42BE9306C051469DA9559016 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B20D85CE3AC647209454ADCD /* libPods.a */; }; - C751BD0F199FC67C00EC7FD6 /* VBFPopFlatButton.m in Sources */ = {isa = PBXBuildFile; fileRef = C751BD0D199FC67C00EC7FD6 /* VBFPopFlatButton.m */; }; + C733771019A0370F001896CA /* VBFDoubleSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = C733770D19A0370F001896CA /* VBFDoubleSegment.m */; }; + C733771119A0370F001896CA /* VBFPopFlatButton.m in Sources */ = {isa = PBXBuildFile; fileRef = C733770F19A0370F001896CA /* VBFPopFlatButton.m */; }; C751BD14199FC72900EC7FD6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C751BD13199FC72900EC7FD6 /* CoreGraphics.framework */; }; C751BD16199FC73400EC7FD6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C751BD15199FC73400EC7FD6 /* UIKit.framework */; }; C751BD18199FC73E00EC7FD6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C751BD17199FC73E00EC7FD6 /* Foundation.framework */; }; C754655B199FC84500B06B35 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C754655A199FC84500B06B35 /* QuartzCore.framework */; }; - C754655E199FC8A100B06B35 /* VBFDoubleSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = C754655D199FC8A100B06B35 /* VBFDoubleSegment.m */; }; C7C4924B199FC4A2004CAF5A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C7C4924A199FC4A2004CAF5A /* main.m */; }; C7C4924E199FC4A2004CAF5A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C7C4924D199FC4A2004CAF5A /* AppDelegate.m */; }; C7C49251199FC4A2004CAF5A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C7C49250199FC4A2004CAF5A /* ViewController.m */; }; @@ -35,14 +35,14 @@ /* Begin PBXFileReference section */ 0E4700CABFE446B7AB63DC37 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; B20D85CE3AC647209454ADCD /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - C751BD0C199FC67C00EC7FD6 /* VBFPopFlatButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VBFPopFlatButton.h; sourceTree = ""; }; - C751BD0D199FC67C00EC7FD6 /* VBFPopFlatButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VBFPopFlatButton.m; sourceTree = ""; }; + C733770C19A0370F001896CA /* VBFDoubleSegment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VBFDoubleSegment.h; path = VBFPopFlatButtonClasses/VBFDoubleSegment.h; sourceTree = ""; }; + C733770D19A0370F001896CA /* VBFDoubleSegment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VBFDoubleSegment.m; path = VBFPopFlatButtonClasses/VBFDoubleSegment.m; sourceTree = ""; }; + C733770E19A0370F001896CA /* VBFPopFlatButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VBFPopFlatButton.h; path = VBFPopFlatButtonClasses/VBFPopFlatButton.h; sourceTree = ""; }; + C733770F19A0370F001896CA /* VBFPopFlatButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VBFPopFlatButton.m; path = VBFPopFlatButtonClasses/VBFPopFlatButton.m; sourceTree = ""; }; C751BD13199FC72900EC7FD6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; C751BD15199FC73400EC7FD6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; C751BD17199FC73E00EC7FD6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; C754655A199FC84500B06B35 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - C754655C199FC8A100B06B35 /* VBFDoubleSegment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VBFDoubleSegment.h; sourceTree = ""; }; - C754655D199FC8A100B06B35 /* VBFDoubleSegment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VBFDoubleSegment.m; sourceTree = ""; }; C7C49245199FC4A2004CAF5A /* VBFPopFlatButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VBFPopFlatButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7C49249199FC4A2004CAF5A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C7C4924A199FC4A2004CAF5A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -95,10 +95,10 @@ C751BD10199FC68300EC7FD6 /* VBFPopFlatButton */ = { isa = PBXGroup; children = ( - C751BD0C199FC67C00EC7FD6 /* VBFPopFlatButton.h */, - C751BD0D199FC67C00EC7FD6 /* VBFPopFlatButton.m */, - C754655C199FC8A100B06B35 /* VBFDoubleSegment.h */, - C754655D199FC8A100B06B35 /* VBFDoubleSegment.m */, + C733770C19A0370F001896CA /* VBFDoubleSegment.h */, + C733770D19A0370F001896CA /* VBFDoubleSegment.m */, + C733770E19A0370F001896CA /* VBFPopFlatButton.h */, + C733770F19A0370F001896CA /* VBFPopFlatButton.m */, ); name = VBFPopFlatButton; sourceTree = ""; @@ -298,10 +298,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C733771119A0370F001896CA /* VBFPopFlatButton.m in Sources */, C7C49251199FC4A2004CAF5A /* ViewController.m in Sources */, - C751BD0F199FC67C00EC7FD6 /* VBFPopFlatButton.m in Sources */, + C733771019A0370F001896CA /* VBFDoubleSegment.m in Sources */, C7C4924E199FC4A2004CAF5A /* AppDelegate.m in Sources */, - C754655E199FC8A100B06B35 /* VBFDoubleSegment.m in Sources */, C7C4924B199FC4A2004CAF5A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/VBFPopFlatButton.xcworkspace/xcshareddata/VBFPopFlatButton.xccheckout b/VBFPopFlatButton.xcworkspace/xcshareddata/VBFPopFlatButton.xccheckout new file mode 100644 index 0000000..6a46461 --- /dev/null +++ b/VBFPopFlatButton.xcworkspace/xcshareddata/VBFPopFlatButton.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 2A502538-C87B-4387-9593-FAA5B008AA28 + IDESourceControlProjectName + VBFPopFlatButton + IDESourceControlProjectOriginsDictionary + + A9382D58-F924-4E60-8E1E-4F41803E2677 + ssh://github.com/iBaro/VBFPopFlatButton.git + + IDESourceControlProjectPath + VBFPopFlatButton.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + A9382D58-F924-4E60-8E1E-4F41803E2677 + .. + + IDESourceControlProjectURL + ssh://github.com/iBaro/VBFPopFlatButton.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + A9382D58-F924-4E60-8E1E-4F41803E2677 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + A9382D58-F924-4E60-8E1E-4F41803E2677 + IDESourceControlWCCName + VBFPopFlatButton + + + + diff --git a/VBFPopFlatButton/VBFDoubleSegment.h b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFDoubleSegment.h similarity index 100% rename from VBFPopFlatButton/VBFDoubleSegment.h rename to VBFPopFlatButton/VBFPopFlatButtonClasses/VBFDoubleSegment.h diff --git a/VBFPopFlatButton/VBFDoubleSegment.m b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFDoubleSegment.m similarity index 100% rename from VBFPopFlatButton/VBFDoubleSegment.m rename to VBFPopFlatButton/VBFPopFlatButtonClasses/VBFDoubleSegment.m diff --git a/VBFPopFlatButton/VBFPopFlatButton.h b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h similarity index 100% rename from VBFPopFlatButton/VBFPopFlatButton.h rename to VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.h diff --git a/VBFPopFlatButton/VBFPopFlatButton.m b/VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m similarity index 100% rename from VBFPopFlatButton/VBFPopFlatButton.m rename to VBFPopFlatButton/VBFPopFlatButtonClasses/VBFPopFlatButton.m diff --git a/VBFPopFlatButton/ViewController.m b/VBFPopFlatButton/ViewController.m index 4bc025a..f3f579e 100644 --- a/VBFPopFlatButton/ViewController.m +++ b/VBFPopFlatButton/ViewController.m @@ -11,7 +11,9 @@ #import "VBFPopFlatButton.h" @interface ViewController () -@property (nonatomic, strong) VBFPopFlatButton *flatButton; +@property (nonatomic, strong) VBFPopFlatButton *flatRoundedButton; +@property (nonatomic, strong) VBFPopFlatButton *flatPlainButton; + @end @implementation ViewController @@ -21,29 +23,47 @@ // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = [UIColor flatPeterRiverColor]; - self.flatButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(150, 150, 30, 30) + self.flatRoundedButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(100, 150, 30, 30) buttonType:buttonMenuType buttonStyle:buttonRoundedStyle]; - self.flatButton.roundBackgroundColor = [UIColor whiteColor]; - self.flatButton.lineThickness = 2; - self.flatButton.linesColor = [UIColor flatPeterRiverColor]; - [self.flatButton addTarget:self action:@selector(flatButtonPressed) forControlEvents:UIControlEventTouchUpInside]; - [self.view addSubview:self.flatButton]; + self.flatRoundedButton.roundBackgroundColor = [UIColor whiteColor]; + self.flatRoundedButton.lineThickness = 2; + self.flatRoundedButton.linesColor = [UIColor flatPeterRiverColor]; + [self.flatRoundedButton addTarget:self + action:@selector(flatRoundedButtonPressed) + forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:self.flatRoundedButton]; + + + self.flatPlainButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(200, 150, 30, 30) + buttonType:buttonAddType + buttonStyle:buttonPlainStyle]; + self.flatPlainButton.lineThickness = 2; + self.flatPlainButton.linesColor = [UIColor whiteColor]; + [self.flatPlainButton addTarget:self + action:@selector(flatPlainButtonPressed) + forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:self.flatPlainButton]; } - (IBAction)buttonPressed:(UIButton *)sender { if (sender.tag != 9) { - [self.flatButton animateToType:sender.tag]; + [self.flatRoundedButton animateToType:sender.tag]; + [self.flatPlainButton animateToType:sender.tag]; } else { - [self.flatButton animateToType:arc4random()%9]; + [self.flatRoundedButton animateToType:arc4random()%9]; + [self.flatPlainButton animateToType:arc4random()%9]; } } -- (void) flatButtonPressed { +- (void) flatRoundedButtonPressed { NSLog(@"Button pressed"); - [self.flatButton animateToType:arc4random()%9]; + [self.flatRoundedButton animateToType:arc4random()%9]; } - +- (void) flatPlainButtonPressed { + NSLog(@"Button pressed"); + [self.flatPlainButton animateToType:arc4random()%9]; +} @end