diff --git a/BTButton/BTButton.h b/BDBAttributedButton/BDBAttributedButton.h similarity index 79% rename from BTButton/BTButton.h rename to BDBAttributedButton/BDBAttributedButton.h index 6d79aa8..b953e1c 100644 --- a/BTButton/BTButton.h +++ b/BDBAttributedButton/BDBAttributedButton.h @@ -1,5 +1,5 @@ // -// BTButton.h +// BDBAttributedButton.h // // Copyright (c) 2014 Bradley David Bergeron // @@ -23,14 +23,14 @@ @import UIKit; -FOUNDATION_EXPORT NSString * const BTButtonCornerRadiusName; -FOUNDATION_EXPORT NSString * const BTButtonFillColorName; -FOUNDATION_EXPORT NSString * const BTButtonBorderColorName; -FOUNDATION_EXPORT NSString * const BTButtonBorderWidthName; +FOUNDATION_EXPORT NSString * const BDBAttributedButtonCornerRadiusName; +FOUNDATION_EXPORT NSString * const BDBAttributedButtonFillColorName; +FOUNDATION_EXPORT NSString * const BDBAttributedButtonBorderColorName; +FOUNDATION_EXPORT NSString * const BDBAttributedButtonBorderWidthName; #pragma mark - -@interface BTButton : UIButton +@interface BDBAttributedButton : UIButton - (void)setStyleAttributes:(NSDictionary *)attributes forControlState:(UIControlState)state; - (NSDictionary *)styleAttributesForControlState:(UIControlState)state; diff --git a/BTButton/BTButton.m b/BDBAttributedButton/BDBAttributedButton.m similarity index 72% rename from BTButton/BTButton.m rename to BDBAttributedButton/BDBAttributedButton.m index 1727e43..90f1858 100644 --- a/BTButton/BTButton.m +++ b/BDBAttributedButton/BDBAttributedButton.m @@ -1,5 +1,5 @@ // -// BTButton.m +// BDBAttributedButton.m // // Copyright (c) 2014 Bradley David Bergeron // @@ -20,17 +20,17 @@ // 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. -#import "BTButton.h" +#import "BDBAttributedButton.h" -NSString * const BTButtonCornerRadiusName = @"com.bradbergeron.BTButtonCornerRadiusName"; -NSString * const BTButtonFillColorName = @"com.bradbergeron.BTButtonFillColorName"; -NSString * const BTButtonBorderColorName = @"com.bradbergeron.BTButtonBorderColorName"; -NSString * const BTButtonBorderWidthName = @"com.bradbergeron.BTButtonBorderWidthName"; +NSString * const BDBAttributedButtonCornerRadiusName = @"com.bradbergeron.BDBAttributedButtonCornerRadiusName"; +NSString * const BDBAttributedButtonFillColorName = @"com.bradbergeron.BDBAttributedButtonFillColorName"; +NSString * const BDBAttributedButtonBorderColorName = @"com.bradbergeron.BDBAttributedButtonBorderColorName"; +NSString * const BDBAttributedButtonBorderWidthName = @"com.bradbergeron.BDBAttributedButtonBorderWidthName"; #pragma mark - -@interface BTButton () +@interface BDBAttributedButton () @property (nonatomic) NSMutableDictionary *styleAttributes; @@ -38,7 +38,7 @@ @interface BTButton () #pragma mark - -@implementation BTButton +@implementation BDBAttributedButton #pragma mark View Lifecycle - (id)initWithFrame:(CGRect)frame @@ -58,7 +58,8 @@ - (id)initWithFrame:(CGRect)frame - (void)layoutSubviews { [super layoutSubviews]; - [super setBackgroundImage:[self btbutton_backgroundImageForState:self.state] forState:self.state]; + [super setBackgroundImage:[self BDBAttributedButton_backgroundImageForState:self.state] + forState:self.state]; } #pragma mark Attributes @@ -74,7 +75,7 @@ - (NSDictionary *)styleAttributesForControlState:(UIControlState)state } #pragma mark Background Images -static inline NSString *btbutton_NSStringFromUIColor(UIColor *color) +static inline NSString *BDBAttributedButton_NSStringFromUIColor(UIColor *color) { if (!color) return nil; @@ -86,7 +87,7 @@ - (NSDictionary *)styleAttributesForControlState:(UIControlState)state return [NSString stringWithFormat:@"{%f, %f, %f, %f}", c[0], c[1], c[2], c[3]]; } -- (UIImage *)btbutton_backgroundImageForState:(UIControlState)state +- (UIImage *)BDBAttributedButton_backgroundImageForState:(UIControlState)state { static NSCache *_backgroundImages; static dispatch_once_t onceToken; @@ -98,21 +99,21 @@ - (UIImage *)btbutton_backgroundImageForState:(UIControlState)state if (!attributes) return nil; - CGFloat radius = [attributes[BTButtonCornerRadiusName] floatValue]; + CGFloat radius = [attributes[BDBAttributedButtonCornerRadiusName] floatValue]; - UIColor *fillColor = attributes[BTButtonFillColorName]; + UIColor *fillColor = attributes[BDBAttributedButtonFillColorName]; if (!fillColor) fillColor = [UIColor clearColor]; - UIColor *borderColor = attributes[BTButtonBorderColorName]; + UIColor *borderColor = attributes[BDBAttributedButtonBorderColorName]; if (!borderColor) borderColor = [UIColor clearColor]; - CGFloat borderWidth = [attributes[BTButtonBorderWidthName] floatValue]; + CGFloat borderWidth = [attributes[BDBAttributedButtonBorderWidthName] floatValue]; NSString *identifier = - [NSString stringWithFormat:@"BTButtonBackgroundImage_r%0.2f_f%@_b%@_w%0.2f", radius, - btbutton_NSStringFromUIColor(fillColor), btbutton_NSStringFromUIColor(borderColor), + [NSString stringWithFormat:@"BDBAttributedButtonBackgroundImage_r%0.2f_f%@_b%@_w%0.2f", radius, + BDBAttributedButton_NSStringFromUIColor(fillColor), BDBAttributedButton_NSStringFromUIColor(borderColor), borderWidth]; UIImage *image = [_backgroundImages objectForKey:identifier]; diff --git a/BDBAttributedButtonDemo.podspec b/BDBAttributedButtonDemo.podspec new file mode 100644 index 0000000..7c03505 --- /dev/null +++ b/BDBAttributedButtonDemo.podspec @@ -0,0 +1,15 @@ +Pod::Spec.new do |s| + s.name = 'BDBAttributedButton' + s.version = '1.0.0' + s.license = 'MIT' + s.summary = 'A UIButton subclass with easy button styling!' + s.homepage = 'https://github.com/bdbergeron/BDBAttributedButton' + s.authors = { 'Bradley David Bergeron' => 'brad@bradbergeron.com' } + s.source = { :git => 'https://github.com/bdbergeron/BDBAttributedButton.git', :tag => s.version.to_s } + s.requires_arc = true + + s.platform = :ios, '7.0' + + s.source_files = 'BDBAttributedButton/*.{h,m}' + s.public_header_files = 'BDBAttributedButton/*.h' +end diff --git a/BTButtonDemo.xcodeproj/project.pbxproj b/BDBAttributedButtonDemo.xcodeproj/project.pbxproj similarity index 81% rename from BTButtonDemo.xcodeproj/project.pbxproj rename to BDBAttributedButtonDemo.xcodeproj/project.pbxproj index 3efa2ec..44f083c 100644 --- a/BTButtonDemo.xcodeproj/project.pbxproj +++ b/BDBAttributedButtonDemo.xcodeproj/project.pbxproj @@ -14,26 +14,26 @@ E84DFAF0188302BE00CCD4DF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E84DFAE8188302BE00CCD4DF /* Images.xcassets */; }; E84DFAF2188302BE00CCD4DF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E84DFAEC188302BE00CCD4DF /* InfoPlist.strings */; }; E84DFAF3188302BE00CCD4DF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E84DFAEE188302BE00CCD4DF /* main.m */; }; - E84DFAF71883031200CCD4DF /* BTButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E84DFAF61883031200CCD4DF /* BTButton.m */; }; E84DFAFE188303E500CCD4DF /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E84DFAFD188303E500CCD4DF /* MainViewController.m */; }; + E8674D7D1888C5F200F839E8 /* BDBAttributedButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E8674D7C1888C5F200F839E8 /* BDBAttributedButton.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - E81A2D1B1883026F00B69199 /* BTButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BTButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E81A2D1B1883026F00B69199 /* BDBAttributedButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BDBAttributedButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; E81A2D1E1883026F00B69199 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; E81A2D201883026F00B69199 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; E81A2D221883026F00B69199 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; E84DFAE5188302BE00CCD4DF /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; E84DFAE6188302BE00CCD4DF /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; E84DFAE8188302BE00CCD4DF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - E84DFAEA188302BE00CCD4DF /* BTButtonDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "BTButtonDemo-Info.plist"; sourceTree = ""; }; - E84DFAEB188302BE00CCD4DF /* BTButtonDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BTButtonDemo-Prefix.pch"; sourceTree = ""; }; + E84DFAEA188302BE00CCD4DF /* BDBAttributedButtonDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "BDBAttributedButtonDemo-Info.plist"; sourceTree = ""; }; + E84DFAEB188302BE00CCD4DF /* BDBAttributedButtonDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BDBAttributedButtonDemo-Prefix.pch"; sourceTree = ""; }; E84DFAED188302BE00CCD4DF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; E84DFAEE188302BE00CCD4DF /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - E84DFAF51883031200CCD4DF /* BTButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTButton.h; sourceTree = ""; }; - E84DFAF61883031200CCD4DF /* BTButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BTButton.m; sourceTree = ""; }; E84DFAFC188303E500CCD4DF /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; E84DFAFD188303E500CCD4DF /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; + E8674D7B1888C5F200F839E8 /* BDBAttributedButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BDBAttributedButton.h; sourceTree = ""; }; + E8674D7C1888C5F200F839E8 /* BDBAttributedButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BDBAttributedButton.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -53,8 +53,8 @@ E81A2D121883026F00B69199 = { isa = PBXGroup; children = ( - E84DFAF41883031200CCD4DF /* BTButton */, - E84DFAE4188302BE00CCD4DF /* BTButtonDemo */, + E8674D7A1888C5F200F839E8 /* BDBAttributedButton */, + E84DFAE4188302BE00CCD4DF /* BDBAttributedButtonDemo */, E81A2D1D1883026F00B69199 /* Frameworks */, E81A2D1C1883026F00B69199 /* Products */, ); @@ -63,7 +63,7 @@ E81A2D1C1883026F00B69199 /* Products */ = { isa = PBXGroup; children = ( - E81A2D1B1883026F00B69199 /* BTButtonDemo.app */, + E81A2D1B1883026F00B69199 /* BDBAttributedButtonDemo.app */, ); name = Products; sourceTree = ""; @@ -78,7 +78,7 @@ name = Frameworks; sourceTree = ""; }; - E84DFAE4188302BE00CCD4DF /* BTButtonDemo */ = { + E84DFAE4188302BE00CCD4DF /* BDBAttributedButtonDemo */ = { isa = PBXGroup; children = ( E84DFAE5188302BE00CCD4DF /* AppDelegate.h */, @@ -87,7 +87,7 @@ E84DFAFB188303E500CCD4DF /* View Controllers */, E84DFAE9188302BE00CCD4DF /* Supporting Files */, ); - path = BTButtonDemo; + path = BDBAttributedButtonDemo; sourceTree = ""; }; E84DFAE7188302BE00CCD4DF /* Resources */ = { @@ -101,38 +101,38 @@ E84DFAE9188302BE00CCD4DF /* Supporting Files */ = { isa = PBXGroup; children = ( - E84DFAEA188302BE00CCD4DF /* BTButtonDemo-Info.plist */, - E84DFAEB188302BE00CCD4DF /* BTButtonDemo-Prefix.pch */, + E84DFAEA188302BE00CCD4DF /* BDBAttributedButtonDemo-Info.plist */, + E84DFAEB188302BE00CCD4DF /* BDBAttributedButtonDemo-Prefix.pch */, E84DFAEC188302BE00CCD4DF /* InfoPlist.strings */, E84DFAEE188302BE00CCD4DF /* main.m */, ); path = "Supporting Files"; sourceTree = ""; }; - E84DFAF41883031200CCD4DF /* BTButton */ = { + E84DFAFB188303E500CCD4DF /* View Controllers */ = { isa = PBXGroup; children = ( - E84DFAF51883031200CCD4DF /* BTButton.h */, - E84DFAF61883031200CCD4DF /* BTButton.m */, + E84DFAFC188303E500CCD4DF /* MainViewController.h */, + E84DFAFD188303E500CCD4DF /* MainViewController.m */, ); - path = BTButton; + path = "View Controllers"; sourceTree = ""; }; - E84DFAFB188303E500CCD4DF /* View Controllers */ = { + E8674D7A1888C5F200F839E8 /* BDBAttributedButton */ = { isa = PBXGroup; children = ( - E84DFAFC188303E500CCD4DF /* MainViewController.h */, - E84DFAFD188303E500CCD4DF /* MainViewController.m */, + E8674D7B1888C5F200F839E8 /* BDBAttributedButton.h */, + E8674D7C1888C5F200F839E8 /* BDBAttributedButton.m */, ); - path = "View Controllers"; + path = BDBAttributedButton; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - E81A2D1A1883026F00B69199 /* BTButtonDemo */ = { + E81A2D1A1883026F00B69199 /* BDBAttributedButtonDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = E81A2D471883026F00B69199 /* Build configuration list for PBXNativeTarget "BTButtonDemo" */; + buildConfigurationList = E81A2D471883026F00B69199 /* Build configuration list for PBXNativeTarget "BDBAttributedButtonDemo" */; buildPhases = ( E81A2D171883026F00B69199 /* Sources */, E81A2D181883026F00B69199 /* Frameworks */, @@ -142,9 +142,9 @@ ); dependencies = ( ); - name = BTButtonDemo; + name = BDBAttributedButtonDemo; productName = BTButtonDemo; - productReference = E81A2D1B1883026F00B69199 /* BTButtonDemo.app */; + productReference = E81A2D1B1883026F00B69199 /* BDBAttributedButtonDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -156,7 +156,7 @@ LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Bradley David Bergeron"; }; - buildConfigurationList = E81A2D161883026F00B69199 /* Build configuration list for PBXProject "BTButtonDemo" */; + buildConfigurationList = E81A2D161883026F00B69199 /* Build configuration list for PBXProject "BDBAttributedButtonDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -168,7 +168,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - E81A2D1A1883026F00B69199 /* BTButtonDemo */, + E81A2D1A1883026F00B69199 /* BDBAttributedButtonDemo */, ); }; /* End PBXProject section */ @@ -190,8 +190,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + E8674D7D1888C5F200F839E8 /* BDBAttributedButton.m in Sources */, E84DFAF3188302BE00CCD4DF /* main.m in Sources */, - E84DFAF71883031200CCD4DF /* BTButton.m in Sources */, E84DFAEF188302BE00CCD4DF /* AppDelegate.m in Sources */, E84DFAFE188303E500CCD4DF /* MainViewController.m in Sources */, ); @@ -291,10 +291,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "BTButtonDemo/Supporting Files/BTButtonDemo-Prefix.pch"; + GCC_PREFIX_HEADER = "BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Prefix.pch"; GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = "$(SRCROOT)/BTButtonDemo/Supporting Files/BTButtonDemo-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; + INFOPLIST_FILE = "BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Info.plist"; + PRODUCT_NAME = BDBAttributedButtonDemo; WARNING_CFLAGS = ( "-Weverything", "-Wno-unused-exception-parameter", @@ -310,10 +310,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "BTButtonDemo/Supporting Files/BTButtonDemo-Prefix.pch"; + GCC_PREFIX_HEADER = "BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Prefix.pch"; GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = "$(SRCROOT)/BTButtonDemo/Supporting Files/BTButtonDemo-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; + INFOPLIST_FILE = "BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Info.plist"; + PRODUCT_NAME = BDBAttributedButtonDemo; WARNING_CFLAGS = ( "-Weverything", "-Wno-unused-exception-parameter", @@ -326,7 +326,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - E81A2D161883026F00B69199 /* Build configuration list for PBXProject "BTButtonDemo" */ = { + E81A2D161883026F00B69199 /* Build configuration list for PBXProject "BDBAttributedButtonDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( E81A2D451883026F00B69199 /* Debug */, @@ -335,7 +335,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E81A2D471883026F00B69199 /* Build configuration list for PBXNativeTarget "BTButtonDemo" */ = { + E81A2D471883026F00B69199 /* Build configuration list for PBXNativeTarget "BDBAttributedButtonDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( E81A2D481883026F00B69199 /* Debug */, diff --git a/BTButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/BDBAttributedButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 64% rename from BTButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to BDBAttributedButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 458a542..973ab93 100644 --- a/BTButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/BDBAttributedButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:BDBAttributedButtonDemo.xcodeproj"> diff --git a/BTButtonDemo/AppDelegate.h b/BDBAttributedButtonDemo/AppDelegate.h similarity index 100% rename from BTButtonDemo/AppDelegate.h rename to BDBAttributedButtonDemo/AppDelegate.h diff --git a/BTButtonDemo/AppDelegate.m b/BDBAttributedButtonDemo/AppDelegate.m similarity index 100% rename from BTButtonDemo/AppDelegate.m rename to BDBAttributedButtonDemo/AppDelegate.m diff --git a/BTButtonDemo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json b/BDBAttributedButtonDemo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from BTButtonDemo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json rename to BDBAttributedButtonDemo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/BTButtonDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json b/BDBAttributedButtonDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json similarity index 100% rename from BTButtonDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json rename to BDBAttributedButtonDemo/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json diff --git a/BTButtonDemo/Supporting Files/BTButtonDemo-Info.plist b/BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Info.plist similarity index 100% rename from BTButtonDemo/Supporting Files/BTButtonDemo-Info.plist rename to BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Info.plist diff --git a/BTButtonDemo/Supporting Files/BTButtonDemo-Prefix.pch b/BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Prefix.pch similarity index 100% rename from BTButtonDemo/Supporting Files/BTButtonDemo-Prefix.pch rename to BDBAttributedButtonDemo/Supporting Files/BDBAttributedButtonDemo-Prefix.pch diff --git a/BTButtonDemo/Supporting Files/en.lproj/InfoPlist.strings b/BDBAttributedButtonDemo/Supporting Files/en.lproj/InfoPlist.strings similarity index 100% rename from BTButtonDemo/Supporting Files/en.lproj/InfoPlist.strings rename to BDBAttributedButtonDemo/Supporting Files/en.lproj/InfoPlist.strings diff --git a/BDBAttributedButtonDemo/Supporting Files/main.m b/BDBAttributedButtonDemo/Supporting Files/main.m new file mode 100644 index 0000000..e9594b1 --- /dev/null +++ b/BDBAttributedButtonDemo/Supporting Files/main.m @@ -0,0 +1,32 @@ +// +// main.m +// +// Copyright (c) 2014 Bradley David Bergeron +// +// 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. + +@import UIKit; + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/BTButtonDemo/View Controllers/MainViewController.h b/BDBAttributedButtonDemo/View Controllers/MainViewController.h similarity index 100% rename from BTButtonDemo/View Controllers/MainViewController.h rename to BDBAttributedButtonDemo/View Controllers/MainViewController.h diff --git a/BTButtonDemo/View Controllers/MainViewController.m b/BDBAttributedButtonDemo/View Controllers/MainViewController.m similarity index 78% rename from BTButtonDemo/View Controllers/MainViewController.m rename to BDBAttributedButtonDemo/View Controllers/MainViewController.m index 603592c..fae4bed 100644 --- a/BTButtonDemo/View Controllers/MainViewController.m +++ b/BDBAttributedButtonDemo/View Controllers/MainViewController.m @@ -20,7 +20,7 @@ // 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. -#import "BTButton.h" +#import "BDBAttributedButton.h" #import "MainViewController.h" @@ -44,10 +44,10 @@ - (void)viewDidLoad NSMutableAttributedString *buttonHighlightedTitle = [buttonTitle mutableCopy]; [buttonHighlightedTitle addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:NSMakeRange(0, buttonTitle.length)]; - NSDictionary *buttonAttributes = @{BTButtonCornerRadiusName:@(10.0f), BTButtonBorderWidthName:@(1.0f), BTButtonBorderColorName:[UIColor redColor]}; - NSDictionary *buttonHighlightedAttributes = @{BTButtonCornerRadiusName:@(10.0f), BTButtonBorderWidthName:@(1.0f), BTButtonBorderColorName:[UIColor darkGrayColor]}; + NSDictionary *buttonAttributes = @{BDBAttributedButtonCornerRadiusName:@(10.0f), BDBAttributedButtonBorderWidthName:@(1.0f), BDBAttributedButtonBorderColorName:[UIColor redColor]}; + NSDictionary *buttonHighlightedAttributes = @{BDBAttributedButtonCornerRadiusName:@(10.0f), BDBAttributedButtonBorderWidthName:@(1.0f), BDBAttributedButtonBorderColorName:[UIColor darkGrayColor]}; - BTButton *button = [[BTButton alloc] initWithFrame:CGRectMake(0.0f, 84.0f, 0.0f, 0.0f)]; + BDBAttributedButton *button = [[BDBAttributedButton alloc] initWithFrame:CGRectMake(0.0f, 84.0f, 0.0f, 0.0f)]; [button setAttributedTitle:buttonTitle forState:UIControlStateNormal]; [button setStyleAttributes:buttonAttributes forControlState:UIControlStateNormal]; [button setAttributedTitle:buttonHighlightedTitle forState:UIControlStateHighlighted]; @@ -62,10 +62,10 @@ - (void)viewDidLoad buttonHighlightedTitle = [buttonTitle mutableCopy]; [buttonHighlightedTitle addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, buttonTitle.length)]; - buttonAttributes = @{BTButtonCornerRadiusName:@(10.0f), BTButtonBorderWidthName:@(1.0f), BTButtonBorderColorName:[UIColor orangeColor]}; - buttonHighlightedAttributes = @{BTButtonCornerRadiusName:@(10.0f), BTButtonFillColorName:[UIColor orangeColor]}; + buttonAttributes = @{BDBAttributedButtonCornerRadiusName:@(10.0f), BDBAttributedButtonBorderWidthName:@(1.0f), BDBAttributedButtonBorderColorName:[UIColor orangeColor]}; + buttonHighlightedAttributes = @{BDBAttributedButtonCornerRadiusName:@(10.0f), BDBAttributedButtonFillColorName:[UIColor orangeColor]}; - button = [[BTButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(button.frame) + 16.0f, 0.0f, 0.0f)]; + button = [[BDBAttributedButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(button.frame) + 16.0f, 0.0f, 0.0f)]; [button setAttributedTitle:buttonTitle forState:UIControlStateNormal]; [button setStyleAttributes:buttonAttributes forControlState:UIControlStateNormal]; [button setAttributedTitle:buttonHighlightedTitle forState:UIControlStateHighlighted]; @@ -77,9 +77,9 @@ - (void)viewDidLoad // Button 3: Filled buttonTitle = [self titleWithString:NSLocalizedString(@"Filled Button", nil) font:buttonFont color:[UIColor whiteColor]]; - buttonAttributes = @{BTButtonCornerRadiusName:@(10.0f), BTButtonFillColorName:[UIColor blueColor]}; + buttonAttributes = @{BDBAttributedButtonCornerRadiusName:@(10.0f), BDBAttributedButtonFillColorName:[UIColor blueColor]}; - button = [[BTButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(button.frame) + 16.0f, 0.0f, 0.0f)]; + button = [[BDBAttributedButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMaxY(button.frame) + 16.0f, 0.0f, 0.0f)]; [button setAttributedTitle:buttonTitle forState:UIControlStateNormal]; [button setStyleAttributes:buttonAttributes forControlState:UIControlStateNormal]; [button sizeToFit]; diff --git a/BTButton.podspec b/BTButton.podspec deleted file mode 100644 index cc2b9cf..0000000 --- a/BTButton.podspec +++ /dev/null @@ -1,15 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'BTButton' - s.version = '1.0.0' - s.license = 'MIT' - s.summary = 'A UIButton subclass with easy button styling!' - s.homepage = 'https://github.com/bdbergeron/BTButton' - s.authors = { 'Bradley David Bergeron' => 'brad@bradbergeron.com' } - s.source = { :git => 'https://github.com/bdbergeron/BTButton.git', :tag => s.version.to_s } - s.requires_arc = true - - s.platform = :ios, '7.0' - - s.source_files = 'BTButton/*.{h,m}' - s.public_header_files = 'BTButton/*.h' -end diff --git a/BTButtonDemo/Supporting Files/main.m b/BTButtonDemo/Supporting Files/main.m deleted file mode 100644 index 6935410..0000000 --- a/BTButtonDemo/Supporting Files/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// BTButtonDemo -// -// Created by Bradley Bergeron on 12/1/14. -// Copyright (c) 2014 Bradley David Bergeron. All rights reserved. -// - -@import UIKit; - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/README.md b/README.md index 43aa583..21f8040 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# BTButton +# BDBAttributedButton -BTButton is a UIButton subclass for iOS 7. Although many argue that one should not subclass UIButton, all BTButton does is add a couple methods that make styling buttons in iOS applcations much simpler. +BDBAttributedButton is a UIButton subclass for iOS 7. Although many argue that one should not subclass UIButton, all BDBAttributedButton does is add a couple methods that make styling buttons in iOS applcations much simpler. -Take a look at the included demo app in order to get a full understanding of how BTButton works. +Take a look at the included demo app in order to get a full understanding of how BDBAttributedButton works. -![iPhone Screenshot](https://dl.dropboxusercontent.com/u/6225/GitHub/BTButton/Demo.png) +![iPhone Screenshot](https://dl.dropboxusercontent.com/u/6225/GitHub/BDBAttributedButton/Demo.png) ## Installation -To use BTButton in you projects, you can simply add `pod BTButton, '~> 1.0.0'` to your Podfile, if you're using CocoaPods. If you prefer the manual route, just add the contents of the BTButton folder to your project. Super simple! +To use BDBAttributedButton in you projects, you can simply add `pod BDBAttributedButton, '~> 1.0.0'` to your Podfile, if you're using CocoaPods. If you prefer the manual route, just add the contents of the BDBAttributedButton folder to your project. Super simple! ## Usage -Taking inspiration from Apple's push to using NSAttributedStrings throughout iOS 7, BTButton uses one simple method to set the style of a button. The currently supported customizations are: +Taking inspiration from Apple's push to using NSAttributedStrings throughout iOS 7, BDBAttributedButton uses one simple method to set the style of a button. The currently supported customizations are: * Corner Radius * Fill Color @@ -26,9 +26,9 @@ NSAttributedString *title = [[NSAttributedString alloc] initWithString:@"Button" attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}]; -BTButton *button = [BTButton new]; -[button setStyleAttributes:@{BTButtonCornerRadiusName:@(5.0f), - BTButtonFillColorName:[UIColor red]} +BDBAttributedButton *button = [BDBAttributedButton new]; +[button setStyleAttributes:@{BDBAttributedButtonCornerRadiusName:@(5.0f), + BDBAttributedButtonFillColorName:[UIColor red]} forControlState:UIControlStateNormal]; [button setAttributedTitle:title forControlState:UIControlStateNormal]; [button sizeToFit];