diff --git a/.cocoadocs.yml b/.cocoadocs.yml new file mode 100644 index 0000000..516da11 --- /dev/null +++ b/.cocoadocs.yml @@ -0,0 +1,7 @@ +highlight-color: "#5BBFDE" +highlight-dark-color: "#3175B0" +darker-color: "#499AB3" +darker-dark-color: "#245580" +background-color: "#CCE7FF" +alt-link-color: "#0081a8" +warning-color: "#0F69B8" diff --git a/.gitignore b/.gitignore index cdd2a05..9e5f0fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,25 @@ +# Xcode + .DS_Store +/build/* +*/build/* +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +profile +*.moved-aside +DerivedData +.idea/ +*.hmap +*.xccheckout + -/build/ +#CocoaPods -BButtonDemo.xcodeproj/project.xcworkspace/xcuserdata/jesse.xcuserdatad/ -BButtonDemo.xcodeproj/xcuserdata/jesse.xcuserdatad/ +Pods \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e14ee27 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: objective-c + +before_install: +- brew update +- brew upgrade xctool + +script: +- xctool clean build test -project BButtonDemo.xcodeproj -scheme BButtonDemo -sdk iphonesimulator7.0 ONLY_ACTIVE_ARCH=NO diff --git a/BButton.podspec b/BButton.podspec index e2e39d5..2f82246 100644 --- a/BButton.podspec +++ b/BButton.podspec @@ -1,16 +1,16 @@ Pod::Spec.new do |s| - s.name = "BButton" - s.version = "2.0.0" - s.summary = "BButton is a subclass of UIButton that looks like the Twitter Bootstrap 2.3.1 buttons." - s.homepage = "https://github.com/jessesquires/BButton" - s.screenshots = "https://raw.github.com/jessesquires/BButton/master/Screenshots/screenshot-1.png", "https://raw.github.com/jessesquires/BButton/master/Screenshots/screenshot-2.png" - s.license = 'BSD' - s.author = { "Jesse Squires" => "jesse.d.squires@gmail.com" } - s.source = { :git => "https://github.com/jessesquires/BButton.git", :tag => '2.0.0' } - s.platform = :ios, '5.0' - s.source_files = 'BButton' - s.public_header_files = 'BButton' - s.resource = "BButton/resources/FontAwesome.ttf" - s.requires_arc = true - s.framework = 'CoreGraphics' + s.name = 'BButton' + s.version = '4.0.2' + s.summary = 'Twitter Bootstrap buttons for iOS.' + s.homepage = 'https://github.com/jessesquires/BButton' + s.license = 'MIT' + s.screenshots = ['https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/screenshot0.png'] + s.authors = { 'Jesse Squires' => 'jesse.squires.developer@gmail.com', 'Mathieu Bolard' => 'mattlawer08@gmail.com' } + s.social_media_url = 'https://twitter.com/jesse_squires' + s.source = { :git => 'https://github.com/jessesquires/BButton.git', :tag => s.version.to_s } + s.platform = :ios, '6.0' + s.source_files = 'BButton/Classes/*' + s.resource = 'BButton/Resources/*' + s.frameworks = 'CoreGraphics' + s.requires_arc = true end diff --git a/BButton/BButton.h b/BButton/BButton.h deleted file mode 100644 index 55c9671..0000000 --- a/BButton/BButton.h +++ /dev/null @@ -1,76 +0,0 @@ -// -// BButton.h -// -// Created by Mathieu Bolard on 31/07/12. -// Copyright (c) 2012 Mathieu Bolard. All rights reserved. -// -// https://github.com/mattlawer/BButton -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import -#import "UIColor+BButton.h" -#import "NSString+FontAwesome.h" - -typedef enum { - BButtonTypeDefault = 0, - BButtonTypePrimary, - BButtonTypeInfo, - BButtonTypeSuccess, - BButtonTypeWarning, - BButtonTypeDanger, - BButtonTypeInverse, - BButtonTypeTwitter, - BButtonTypeFacebook, - BButtonTypePurple, - BButtonTypeGray -} BButtonType; - - -@interface BButton : UIButton - -@property (strong, nonatomic) UIColor *color; -@property (assign, nonatomic) BOOL shouldShowDisabled; - -#pragma mark - Initialization -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type; -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type icon:(FAIcon)icon fontSize:(CGFloat)fontSize; - -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor; -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor icon:(FAIcon)icon fontSize:(CGFloat)fontSize; - -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon type:(BButtonType)type; -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon color:(UIColor *)color; - -#pragma mark - BButton -- (void)setType:(BButtonType)type; -- (void)addAwesomeIcon:(FAIcon)icon beforeTitle:(BOOL)before; - -@end \ No newline at end of file diff --git a/BButton/BButton.m b/BButton/BButton.m deleted file mode 100644 index 351827e..0000000 --- a/BButton/BButton.m +++ /dev/null @@ -1,347 +0,0 @@ -// -// BButton.m -// -// Created by Mathieu Bolard on 31/07/12. -// Copyright (c) 2012 Mathieu Bolard. All rights reserved. -// -// https://github.com/mattlawer/BButton -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import "BButton.h" -#import - -@interface BButton () - -@property (assign, nonatomic) CGGradientRef gradient; - -- (void)setup; -+ (UIColor *)colorForButtonType:(BButtonType)type; -- (void)setGradientEnabled:(BOOL)enabled; - -@end - - - -@implementation BButton - -@synthesize color; -@synthesize gradient; -@synthesize shouldShowDisabled; - -#pragma mark - Initialization -- (void)setup -{ - self.backgroundColor = [UIColor clearColor]; - self.titleLabel.shadowOffset = CGSizeMake(0.0f, -1.0f); - self.titleLabel.font = [UIFont boldSystemFontOfSize:17.0f]; - self.shouldShowDisabled = NO; - [self setType:BButtonTypeDefault]; -} - -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type -{ - return [self initWithFrame:frame color:[BButton colorForButtonType:type]]; -} - -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type icon:(FAIcon)icon fontSize:(CGFloat)fontSize -{ - return [self initWithFrame:frame - color:[BButton colorForButtonType:type] - icon:icon - fontSize:fontSize]; -} - -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor -{ - self = [self initWithFrame:frame]; - if(self) { - self.color = aColor; - } - return self; -} - -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor icon:(FAIcon)icon fontSize:(CGFloat)fontSize -{ - self = [self initWithFrame:frame color:aColor]; - if(self) { - self.titleLabel.font = [UIFont fontWithName:@"FontAwesome" size:fontSize]; - self.titleLabel.textAlignment = NSTextAlignmentCenter; - [self setTitle:[NSString stringFromAwesomeIcon:icon] forState:UIControlStateNormal]; - } - return self; -} - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if(self) { - [self setup]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)aDecoder -{ - self = [super initWithCoder:aDecoder]; - if(self) { - [self setup]; - } - return self; -} - -- (id)init -{ - self = [super init]; - if(self) { - [self setup]; - } - return self; -} - -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon type:(BButtonType)type -{ - return [BButton awesomeButtonWithOnlyIcon:icon - color:[BButton colorForButtonType:type]]; -} - -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon color:(UIColor *)color -{ - return [[BButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 40.0f, 40.0f) - color:color - icon:icon - fontSize:20.0f]; -} - -#pragma mark - Parent overrides -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - [self setNeedsDisplay]; -} - -- (void)setEnabled:(BOOL)enabled -{ - [super setEnabled:enabled]; - - if(self.shouldShowDisabled) - [self setGradientEnabled:enabled]; - - [self setNeedsDisplay]; -} - -#pragma mark - Setters -- (void)setColor:(UIColor *)newColor -{ - color = newColor; - - if([newColor isLightColor]) { - [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; - [self setTitleShadowColor:[[UIColor whiteColor] colorWithAlphaComponent:0.6f] forState:UIControlStateNormal]; - - if(self.shouldShowDisabled) - [self setTitleColor:[UIColor colorWithWhite:0.4f alpha:0.5f] forState:UIControlStateDisabled]; - } - else { - [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [self setTitleShadowColor:[[UIColor blackColor] colorWithAlphaComponent:0.6f] forState:UIControlStateNormal]; - - if(self.shouldShowDisabled) - [self setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.5f] forState:UIControlStateDisabled]; - } - - if(self.shouldShowDisabled) - [self setGradientEnabled:self.enabled]; - else - [self setGradientEnabled:YES]; - - [self setNeedsDisplay]; -} - -- (void)setShouldShowDisabled:(BOOL)show -{ - shouldShowDisabled = show; - - if(show) { - if([self.color isLightColor]) - [self setTitleColor:[UIColor colorWithWhite:0.4f alpha:0.5f] forState:UIControlStateDisabled]; - else - [self setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.5f] forState:UIControlStateDisabled]; - } - else { - if([self.color isLightColor]) - [self setTitleColor:[UIColor blackColor] forState:UIControlStateDisabled]; - else - [self setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled]; - } -} - -#pragma mark - BButton -- (void)setType:(BButtonType)type -{ - self.color = [BButton colorForButtonType:type]; -} - -- (void)addAwesomeIcon:(FAIcon)icon beforeTitle:(BOOL)before -{ - NSString *iconString = [NSString stringFromAwesomeIcon:icon]; - self.titleLabel.font = [UIFont fontWithName:@"FontAwesome" - size:self.titleLabel.font.pointSize]; - - NSString *title = [NSString stringWithFormat:@"%@", iconString]; - - if(![self.titleLabel.text isEmpty]) { - if(before) - title = [title stringByAppendingFormat:@" %@", self.titleLabel.text]; - else - title = [NSString stringWithFormat:@"%@ %@", self.titleLabel.text, iconString]; - } - - [self setTitle:title forState:UIControlStateNormal]; -} - -+ (UIColor *)colorForButtonType:(BButtonType)type -{ - UIColor *newColor = nil; - - switch (type) { - case BButtonTypePrimary: - newColor = [UIColor colorWithRed:0.00f green:0.33f blue:0.80f alpha:1.00f]; - break; - case BButtonTypeInfo: - newColor = [UIColor colorWithRed:0.18f green:0.59f blue:0.71f alpha:1.00f]; - break; - case BButtonTypeSuccess: - newColor = [UIColor colorWithRed:0.32f green:0.64f blue:0.32f alpha:1.00f]; - break; - case BButtonTypeWarning: - newColor = [UIColor colorWithRed:0.97f green:0.58f blue:0.02f alpha:1.00f]; - break; - case BButtonTypeDanger: - newColor = [UIColor colorWithRed:0.74f green:0.21f blue:0.18f alpha:1.00f]; - break; - case BButtonTypeInverse: - newColor = [UIColor colorWithRed:0.13f green:0.13f blue:0.13f alpha:1.00f]; - break; - case BButtonTypeTwitter: - newColor = [UIColor colorWithRed:0.25f green:0.60f blue:1.00f alpha:1.00f]; - break; - case BButtonTypeFacebook: - newColor = [UIColor colorWithRed:0.23f green:0.35f blue:0.60f alpha:1.00f]; - break; - case BButtonTypePurple: - newColor = [UIColor colorWithRed:0.45f green:0.30f blue:0.75f alpha:1.00f]; - break; - case BButtonTypeGray: - newColor = [UIColor colorWithRed:0.60f green:0.60f blue:0.60f alpha:1.00f]; - break; - case BButtonTypeDefault: - default: - newColor = [UIColor colorWithRed:0.85f green:0.85f blue:0.85f alpha:1.00f]; - break; - } - - return newColor; -} - -#pragma mark - Drawing -- (void)drawRect:(CGRect)rect -{ - [super drawRect:rect]; - CGContextRef context = UIGraphicsGetCurrentContext(); - - UIColor *border = [self.color darkenColorWithValue:0.06f]; - - // Shadow Declarations - UIColor *shadow = [self.color lightenColorWithValue:0.50f]; - CGSize shadowOffset = CGSizeMake(0.0f, 1.0f); - CGFloat shadowBlurRadius = 2.0f; - - // Rounded Rectangle Drawing - UIBezierPath *roundedRectanglePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.5f, 0.5f, rect.size.width-1.0f, rect.size.height-1.0f) - cornerRadius:6.0f]; - - CGContextSaveGState(context); - - [roundedRectanglePath addClip]; - - CGContextDrawLinearGradient(context, - self.gradient, - CGPointMake(0.0f, self.highlighted ? rect.size.height - 0.5f : 0.5f), - CGPointMake(0.0f, self.highlighted ? 0.5f : rect.size.height - 0.5f), 0.0f); - - CGContextRestoreGState(context); - - if(!self.highlighted) { - // Rounded Rectangle Inner Shadow - CGRect roundedRectangleBorderRect = CGRectInset([roundedRectanglePath bounds], -shadowBlurRadius, -shadowBlurRadius); - roundedRectangleBorderRect = CGRectOffset(roundedRectangleBorderRect, -shadowOffset.width, -shadowOffset.height); - roundedRectangleBorderRect = CGRectInset(CGRectUnion(roundedRectangleBorderRect, [roundedRectanglePath bounds]), -1.0f, -1.0f); - - UIBezierPath *roundedRectangleNegativePath = [UIBezierPath bezierPathWithRect: roundedRectangleBorderRect]; - [roundedRectangleNegativePath appendPath: roundedRectanglePath]; - roundedRectangleNegativePath.usesEvenOddFillRule = YES; - - CGContextSaveGState(context); - { - CGFloat xOffset = shadowOffset.width + round(roundedRectangleBorderRect.size.width); - CGFloat yOffset = shadowOffset.height; - CGContextSetShadowWithColor(context, - CGSizeMake(xOffset + copysign(0.1f, xOffset), yOffset + copysign(0.1f, yOffset)), - shadowBlurRadius, - shadow.CGColor); - - [roundedRectanglePath addClip]; - CGAffineTransform transform = CGAffineTransformMakeTranslation(-round(roundedRectangleBorderRect.size.width), 0.0f); - [roundedRectangleNegativePath applyTransform: transform]; - [[UIColor grayColor] setFill]; - [roundedRectangleNegativePath fill]; - } - CGContextRestoreGState(context); - } - - [border setStroke]; - roundedRectanglePath.lineWidth = 1.0f; - [roundedRectanglePath stroke]; -} - -- (void)setGradientEnabled:(BOOL)enabled -{ - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - UIColor *topColor = enabled ? [self.color lightenColorWithValue:0.12f] : [self.color darkenColorWithValue:0.12f]; - - NSArray *newGradientColors = [NSArray arrayWithObjects:(id)topColor.CGColor, (id)self.color.CGColor, nil]; - CGFloat newGradientLocations[] = {0.0f, 1.0f}; - - gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)newGradientColors, newGradientLocations); - CGColorSpaceRelease(colorSpace); -} - -@end \ No newline at end of file diff --git a/BButton/Classes/BButton.h b/BButton/Classes/BButton.h new file mode 100644 index 0000000..77bec71 --- /dev/null +++ b/BButton/Classes/BButton.h @@ -0,0 +1,189 @@ +// +// Created by Mathieu Bolard on 31/07/12. +// Copyright (c) 2012 Mathieu Bolard. All rights reserved. +// +// https://github.com/mattlawer/BButton +// +// +// BButton is licensed under the MIT license +// http://opensource.org/licenses/MIT +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import +#import "UIColor+BButton.h" +#import "NSString+FontAwesome.h" + +/** + * A constant describing the button style. + */ +typedef NS_ENUM(NSUInteger, BButtonStyle) { + /** + * Styles the button like bootstrap version 2.x.x. + */ + BButtonStyleBootstrapV2, + /** + * Styles the button like bootstrap version 3.x.x. + */ + BButtonStyleBootstrapV3 +}; + + +/** + * A constant describing the button type. This sets the button color. + */ +typedef NS_ENUM(NSUInteger, BButtonType) { + BButtonTypeDefault, + BButtonTypePrimary, + BButtonTypeInfo, + BButtonTypeSuccess, + BButtonTypeWarning, + BButtonTypeDanger, + BButtonTypeInverse, + BButtonTypeTwitter, + BButtonTypeFacebook, + BButtonTypePurple, + BButtonTypeGray +}; + + +/** + * An instanace of `BButton` is a subclass of `UIButton` that is styled like the Twitter Bootstrap buttons and is drawn entirely with `CoreGraphics`. + */ +@interface BButton : UIButton + +/** + * The color of the button in its normal state. `BButton` automatically darks this color when the button enters its pressed state. The default value is `[UIColor bb_defaultColorV3]`, the color value associated with `BButtonTypeDefault`. @see BButtonType. + */ +@property (strong, nonatomic) UIColor *color; + +/** + * The corner radius of the button. The default value is 6.0 for buttons initialized with style `BButtonStyleBootstrapV2`, or 4.0 for buttons initialized with style `BButtonStyleBootstrapV3`. @see BButtonType. + */ +@property (strong, nonatomic) NSNumber *buttonCornerRadius UI_APPEARANCE_SELECTOR; + +/** + * A boolean value indicating whether or not the button should be drawn to reflect a disabled state when `enabled` is set to `NO`. The default value is `YES`. + */ +@property (assign, nonatomic) BOOL shouldShowDisabled; + +#pragma mark - Initialization + +/** + * Initializes and returns a button having the given frame, type, and style. + * + * @param frame A rectangle specifying the initial location and size of the button in its superview's coordinates. + * @param type A constant that specifies the type of the button. @see BButtonType. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ +- (instancetype)initWithFrame:(CGRect)frame type:(BButtonType)type style:(BButtonStyle)style; + +/** + * Initializes and returns a button having the given frame, type, style, icon, and font size. + * + * @param frame A rectangle specifying the initial location and size of the button in its superview's coordinates. + * @param type A constant that specifies the type of the button. @see BButtonType. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * @param icon A contant that specifies the FontAwesome icon of the button. @see FAIcon. + * @param fontSize A float specifying the font size of the button's `textLabel`. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ +- (instancetype)initWithFrame:(CGRect)frame + type:(BButtonType)type + style:(BButtonStyle)style + icon:(FAIcon)icon + fontSize:(CGFloat)fontSize; + +/** + * Initializes and returns a button having the given frame, color, and style. + * + * @param frame A rectangle specifying the initial location and size of the button in its superview's coordinates. + * @param color A `UIColor` object specifying the color of the button. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ +- (instancetype)initWithFrame:(CGRect)frame color:(UIColor *)color style:(BButtonStyle)style; + +/** + * Initializes and returns a button having the given frame, color, style, icon, and font size. + * + * @param frame A rectangle specifying the initial location and size of the button in its superview's coordinates. + * @param color A `UIColor` object specifying the color of the button. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * @param icon A contant that specifies the FontAwesome icon of the button. @see FAIcon. + * @param fontSize A float specifying the font size of the button's `textLabel`. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ +- (instancetype)initWithFrame:(CGRect)frame + color:(UIColor *)color + style:(BButtonStyle)style + icon:(FAIcon)icon + fontSize:(CGFloat)fontSize; + +/** + * Initializes and returns a special icon-only button having the given icon, type, and style. The button frame is set with an origin of `(0.0, 0.0)` and a size of `(40.0, 40.0)`. The button font size is set to `20.0`. + * + * @param icon A contant that specifies the FontAwesome icon of the button. @see FAIcon. + * @param type A constant that specifies the type of the button. @see BButtonType. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ ++ (instancetype)awesomeButtonWithOnlyIcon:(FAIcon)icon + type:(BButtonType)type + style:(BButtonStyle)style; + +/** + * Initializes and returns a special icon-only button having the given icon, color, and style. The button frame is set with an origin of `(0.0, 0.0)` and a size of `(40.0, 40.0)`. The button font size is set to `20.0`. + * + * @param icon A contant that specifies the FontAwesome icon of the button. @see FAIcon. + * @param color A `UIColor` object specifying the color of the button. + * @param style A constant that specifies the style of the button. @see BButtonStyle. + * + * @return An initialized `BButton` object or `nil` if the object could not be successfully initialized. + */ ++ (instancetype)awesomeButtonWithOnlyIcon:(FAIcon)icon + color:(UIColor *)color + style:(BButtonStyle)style; + +#pragma mark - BButton + +/** + * Sets the style of the button after. @see BButtonStyle. + * + * @param style A constant describing the button style. + * + * @bug If also setting the button type via `setType:`, *you must set the button style first*, via this method. + */ +- (void)setStyle:(BButtonStyle)style; + +/** + * Sets the type of the button. @see BButtonType. + * + * @param type A constant describing the button type. + */ +- (void)setType:(BButtonType)type; + +/** + * Adds the specified icon to the buttons's `titleLabel`, and sets `titleLabel.font` to `FontAwesome.ttf`. + * + * @param icon A constant describing the FontAwesome Icon. @see FAIcon. + * @param before A boolean value indicating if the icon should be placed before or after any existing text. Pass `YES` to place the icon before the text, and `NO` to place the icon after the text. + * + * @warning A single space is inserted between the added icon and existing text. + */ +- (void)addAwesomeIcon:(FAIcon)icon beforeTitle:(BOOL)before; + +@end \ No newline at end of file diff --git a/BButton/Classes/BButton.m b/BButton/Classes/BButton.m new file mode 100644 index 0000000..005e912 --- /dev/null +++ b/BButton/Classes/BButton.m @@ -0,0 +1,514 @@ +// +// Created by Mathieu Bolard on 31/07/12. +// Copyright (c) 2012 Mathieu Bolard. All rights reserved. +// +// https://github.com/mattlawer/BButton +// +// +// BButton is licensed under the MIT license +// http://opensource.org/licenses/MIT +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import "BButton.h" +#import + +static CGFloat const kBButtonCornerRadiusV2 = 6.0f; +static CGFloat const kBButtonCornerRadiusV3 = 4.0f; + +@interface BButton () + +@property (assign, nonatomic) BButtonStyle buttonStyle; + +- (void)setup; +- (void)setTextAttributesForStyle:(BButtonStyle)aStyle; + ++ (UIColor *)colorForButtonType:(BButtonType)type style:(BButtonStyle)style; ++ (UIColor *)colorForV2StyleButtonWithType:(BButtonType)type; ++ (UIColor *)colorForV3StyleButtonWithType:(BButtonType)type; ++ (NSNumber *)cornerRadiusForStyle:(BButtonStyle)aStyle; + +- (NSString *)stringByTrimingWhiteSpaceFromString:(NSString *)str; +- (BOOL)isStringEmpty:(NSString *)str; + +- (void)drawBButtonStyleV2InRect:(CGRect)rect withContext:(CGContextRef *)context; +- (void)drawBButtonStyleV3InRect:(CGRect)rect withContext:(CGContextRef *)context; + +@end + + + +@implementation BButton + +#pragma mark - Setup + +- (void)setup +{ + [self setBackgroundColor:[UIColor clearColor]]; + _shouldShowDisabled = YES; + _buttonStyle = BButtonStyleBootstrapV3; + [self setType:BButtonTypeDefault]; +} + +- (void)setTextAttributesForStyle:(BButtonStyle)aStyle +{ + switch (aStyle) { + case BButtonStyleBootstrapV2: + [[self titleLabel] setShadowOffset:CGSizeMake(0.0f, -1.0f)]; + [[self titleLabel] setFont:[UIFont boldSystemFontOfSize:17.0f]]; + break; + + case BButtonStyleBootstrapV3: + [[self titleLabel] setShadowOffset:CGSizeMake(0.0f, 0.0f)]; + [[self titleLabel] setFont:[UIFont systemFontOfSize:17.0f]]; + break; + } +} + +#pragma mark - Initialization + +- (instancetype)initWithFrame:(CGRect)frame type:(BButtonType)type style:(BButtonStyle)style +{ + return [self initWithFrame:frame + color:[BButton colorForButtonType:type style:style] + style:style]; +} + +- (instancetype)initWithFrame:(CGRect)frame + type:(BButtonType)type + style:(BButtonStyle)style + icon:(FAIcon)icon + fontSize:(CGFloat)fontSize +{ + return [self initWithFrame:frame + color:[BButton colorForButtonType:type style:style] + style:style + icon:icon + fontSize:fontSize]; +} + +- (instancetype)initWithFrame:(CGRect)frame color:(UIColor *)color style:(BButtonStyle)style +{ + NSParameterAssert(color != nil); + + self = [self initWithFrame:frame]; + if (self) { + _buttonStyle = style; + [self setColor:color]; + [self setTextAttributesForStyle:style]; + } + return self; +} + +- (instancetype)initWithFrame:(CGRect)frame + color:(UIColor *)color + style:(BButtonStyle)style + icon:(FAIcon)icon + fontSize:(CGFloat)fontSize +{ + self = [self initWithFrame:frame color:color style:style]; + if (self) { + [[self titleLabel] setFont:[UIFont fontWithName:kFontAwesomeFont size:fontSize]]; + [[self titleLabel] setTextAlignment:NSTextAlignmentCenter]; + [self setTitle:[NSString fa_stringForFontAwesomeIcon:icon] + forState:UIControlStateNormal]; + } + return self; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self setup]; + [self setTextAttributesForStyle:_buttonStyle]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) { + [self setup]; + } + return self; +} + +- (void)dealloc +{ + _color = nil; + _buttonCornerRadius = nil; +} + +#pragma mark - Class initialization + ++ (instancetype)awesomeButtonWithOnlyIcon:(FAIcon)icon + type:(BButtonType)type + style:(BButtonStyle)style +{ + return [BButton awesomeButtonWithOnlyIcon:icon + color:[BButton colorForButtonType:type style:style] + style:style]; +} + ++ (instancetype)awesomeButtonWithOnlyIcon:(FAIcon)icon + color:(UIColor *)color + style:(BButtonStyle)style +{ + return [[BButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 40.0f, 40.0f) + color:color + style:style + icon:icon + fontSize:20.0f]; +} + +#pragma mark - Parent overrides + +- (void)setHighlighted:(BOOL)highlighted +{ + [super setHighlighted:highlighted]; + [self setNeedsDisplay]; +} + +- (void)setEnabled:(BOOL)enabled +{ + [super setEnabled:enabled]; + [self setNeedsDisplay]; +} + +#pragma mark - UIAppearance getters + +- (NSNumber *)buttonCornerRadius +{ + if (!_buttonCornerRadius) { + _buttonCornerRadius = [[[self class] appearance] buttonCornerRadius]; + } + + if (_buttonCornerRadius) { + return _buttonCornerRadius; + } + + return [BButton cornerRadiusForStyle:_buttonStyle]; +} + +#pragma mark - Setters + +- (void)setColor:(UIColor *)newColor +{ + _color = newColor; + + if ([newColor bb_isLightColor]) { + [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + [self setTitleShadowColor:[[UIColor whiteColor] colorWithAlphaComponent:0.6f] forState:UIControlStateNormal]; + + if(self.shouldShowDisabled) + [self setTitleColor:[UIColor colorWithWhite:0.4f alpha:0.5f] forState:UIControlStateDisabled]; + } + else { + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [self setTitleShadowColor:[[UIColor blackColor] colorWithAlphaComponent:0.6f] forState:UIControlStateNormal]; + + if(self.shouldShowDisabled) + [self setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.5f] forState:UIControlStateDisabled]; + } + + [self setNeedsDisplay]; +} + +- (void)setShouldShowDisabled:(BOOL)show +{ + _shouldShowDisabled = show; + + if (show) { + if([self.color bb_isLightColor]) + [self setTitleColor:[UIColor colorWithWhite:0.4f alpha:0.5f] forState:UIControlStateDisabled]; + else + [self setTitleColor:[UIColor colorWithWhite:1.0f alpha:0.5f] forState:UIControlStateDisabled]; + } + else { + if ([self.color bb_isLightColor]) + [self setTitleColor:[UIColor blackColor] forState:UIControlStateDisabled]; + else + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled]; + } +} + +#pragma mark - BButton + +- (void)setStyle:(BButtonStyle)style +{ + _buttonStyle = style; + [self setColor:_color]; +} + +- (void)setType:(BButtonType)type +{ + [self setColor:[BButton colorForButtonType:type + style:_buttonStyle]]; +} + +- (void)addAwesomeIcon:(FAIcon)icon beforeTitle:(BOOL)before +{ + NSString *iconString = [NSString fa_stringForFontAwesomeIcon:icon]; + self.titleLabel.font = [UIFont fontWithName:kFontAwesomeFont + size:self.titleLabel.font.pointSize]; + + NSString *title = [NSString stringWithFormat:@"%@", iconString]; + + if(self.titleLabel.text && ![self isStringEmpty:self.titleLabel.text]) { + if(before) { + title = [title stringByAppendingFormat:@" %@", self.titleLabel.text]; + } + else { + title = [NSString stringWithFormat:@"%@ %@", self.titleLabel.text, iconString]; + } + } + + [self setTitle:title forState:UIControlStateNormal]; +} + ++ (UIColor *)colorForButtonType:(BButtonType)type style:(BButtonStyle)style +{ + switch (style) { + case BButtonStyleBootstrapV2: + return [BButton colorForV2StyleButtonWithType:type]; + case BButtonStyleBootstrapV3: + default: + return [BButton colorForV3StyleButtonWithType:type]; + } +} + ++ (UIColor *)colorForV2StyleButtonWithType:(BButtonType)type +{ + switch (type) { + case BButtonTypePrimary: + return [UIColor bb_primaryColorV2]; + + case BButtonTypeInfo: + return [UIColor bb_infoColorV2]; + + case BButtonTypeSuccess: + return [UIColor bb_successColorV2]; + + case BButtonTypeWarning: + return [UIColor bb_warningColorV2]; + + case BButtonTypeDanger: + return [UIColor bb_dangerColorV2]; + + case BButtonTypeInverse: + return [UIColor bb_inverseColorV2]; + + case BButtonTypeTwitter: + return [UIColor bb_twitterColor]; + + case BButtonTypeFacebook: + return [UIColor bb_facebookColor]; + + case BButtonTypePurple: + return [UIColor bb_purpleBButtonColor]; + + case BButtonTypeGray: + return [UIColor bb_grayBButtonColor]; + + case BButtonTypeDefault: + default: + return [UIColor bb_defaultColorV2]; + } +} + ++ (UIColor *)colorForV3StyleButtonWithType:(BButtonType)type +{ + switch (type) { + case BButtonTypePrimary: + return [UIColor bb_primaryColorV3]; + + case BButtonTypeInfo: + return [UIColor bb_infoColorV3]; + + case BButtonTypeSuccess: + return [UIColor bb_successColorV3]; + + case BButtonTypeWarning: + return [UIColor bb_warningColorV3]; + + case BButtonTypeDanger: + return [UIColor bb_dangerColorV3]; + + case BButtonTypeInverse: + return [UIColor bb_inverseColorV3]; + + case BButtonTypeTwitter: + return [UIColor bb_twitterColor]; + + case BButtonTypeFacebook: + return [UIColor bb_facebookColor]; + + case BButtonTypePurple: + return [UIColor bb_purpleBButtonColor]; + + case BButtonTypeGray: + return [UIColor bb_grayBButtonColor]; + + case BButtonTypeDefault: + default: + return [UIColor bb_defaultColorV3]; + } +} + ++ (NSNumber *)cornerRadiusForStyle:(BButtonStyle)aStyle +{ + CGFloat r = 0.0f; + + switch (aStyle) { + case BButtonStyleBootstrapV2: + r = kBButtonCornerRadiusV2; + break; + case BButtonStyleBootstrapV3: + r = kBButtonCornerRadiusV3; + break; + } + return [NSNumber numberWithFloat:r]; +} + +#pragma mark - Utilities + +- (NSString *)stringByTrimingWhiteSpaceFromString:(NSString *)str +{ + return [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; +} + +- (BOOL)isStringEmpty:(NSString *)str +{ + return [[self stringByTrimingWhiteSpaceFromString:str] isEqualToString:@""]; +} + +#pragma mark - Drawing + +- (void)drawRect:(CGRect)rect +{ + [super drawRect:rect]; + + CGContextRef context = UIGraphicsGetCurrentContext(); + + if (!context) { + return; + } + + NSAssert(self.color != nil, @"Error! Attempting to draw button with nil color. %s", __PRETTY_FUNCTION__); + + switch (self.buttonStyle) { + case BButtonStyleBootstrapV2: + [self drawBButtonStyleV2InRect:rect withContext:&context]; + break; + case BButtonStyleBootstrapV3: + [self drawBButtonStyleV3InRect:rect withContext:&context]; + break; + } +} + +- (void)drawBButtonStyleV2InRect:(CGRect)rect withContext:(CGContextRef *)context +{ + UIColor *border = [self.color bb_darkenColorWithValue:0.06f]; + + UIColor *shadow = [self.color bb_lightenColorWithValue:0.50f]; + CGSize shadowOffset = CGSizeMake(0.0f, 1.0f); + CGFloat shadowBlurRadius = 2.0f; + + UIBezierPath *roundedRectanglePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.5f, 0.5f, rect.size.width-1.0f, rect.size.height-1.0f) + cornerRadius:[self.buttonCornerRadius floatValue]]; + + CGContextSaveGState(*context); + + [roundedRectanglePath addClip]; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + UIColor *topColor = (self.shouldShowDisabled && !self.enabled) ? [self.color bb_darkenColorWithValue:0.12f] : [self.color bb_lightenColorWithValue:0.12f]; + + NSArray *newGradientColors = [NSArray arrayWithObjects:(id)topColor.CGColor, (id)self.color.CGColor, nil]; + CGFloat newGradientLocations[] = {0.0f, 1.0f}; + + CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)newGradientColors, newGradientLocations); + + CGColorSpaceRelease(colorSpace); + + CGContextDrawLinearGradient(*context, + gradient, + CGPointMake(0.0f, self.highlighted ? rect.size.height - 0.5f : 0.5f), + CGPointMake(0.0f, self.highlighted ? 0.5f : rect.size.height - 0.5f), 0.0f); + + CGGradientRelease(gradient); + + CGContextRestoreGState(*context); + + if (!self.highlighted) { + // Rounded Rectangle Inner Shadow + CGRect roundedRectangleBorderRect = CGRectInset([roundedRectanglePath bounds], -shadowBlurRadius, -shadowBlurRadius); + roundedRectangleBorderRect = CGRectOffset(roundedRectangleBorderRect, -shadowOffset.width, -shadowOffset.height); + roundedRectangleBorderRect = CGRectInset(CGRectUnion(roundedRectangleBorderRect, [roundedRectanglePath bounds]), -1.0f, -1.0f); + + UIBezierPath *roundedRectangleNegativePath = [UIBezierPath bezierPathWithRect: roundedRectangleBorderRect]; + [roundedRectangleNegativePath appendPath: roundedRectanglePath]; + roundedRectangleNegativePath.usesEvenOddFillRule = YES; + + CGContextSaveGState(*context); + + CGFloat xOffset = shadowOffset.width + round(roundedRectangleBorderRect.size.width); + CGFloat yOffset = shadowOffset.height; + CGContextSetShadowWithColor(*context, + CGSizeMake(xOffset + copysign(0.1f, xOffset), yOffset + copysign(0.1f, yOffset)), + shadowBlurRadius, + shadow.CGColor); + + [roundedRectanglePath addClip]; + CGAffineTransform transform = CGAffineTransformMakeTranslation(-round(roundedRectangleBorderRect.size.width), 0.0f); + [roundedRectangleNegativePath applyTransform: transform]; + [[UIColor grayColor] setFill]; + [roundedRectangleNegativePath fill]; + + CGContextRestoreGState(*context); + } + + [border setStroke]; + roundedRectanglePath.lineWidth = 1.0f; + [roundedRectanglePath stroke]; +} + +- (void)drawBButtonStyleV3InRect:(CGRect)rect withContext:(CGContextRef *)context +{ + CGContextSaveGState(*context); + + UIColor *fill = (!self.highlighted) ? self.color : [self.color bb_darkenColorWithValue:0.06f]; + if (!self.enabled) { + [fill bb_desaturatedColorToPercentSaturation:0.60f]; + } + + CGContextSetFillColorWithColor(*context, fill.CGColor); + + UIColor *border = (!self.highlighted) ? [self.color bb_darkenColorWithValue:0.06f] : [self.color bb_darkenColorWithValue:0.12f]; + if (!self.enabled) { + [border bb_desaturatedColorToPercentSaturation:0.60f]; + } + + CGContextSetStrokeColorWithColor(*context, border.CGColor); + + CGContextSetLineWidth(*context, 1.0f); + + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.5f, 0.5f, rect.size.width-1.0f, rect.size.height-1.0f) + cornerRadius:[self.buttonCornerRadius floatValue]]; + + CGContextAddPath(*context, path.CGPath); + CGContextDrawPath(*context, kCGPathFillStroke); + + CGContextRestoreGState(*context); +} + +@end \ No newline at end of file diff --git a/BButton/Classes/NSString+FontAwesome.h b/BButton/Classes/NSString+FontAwesome.h new file mode 100644 index 0000000..4ed62dd --- /dev/null +++ b/BButton/Classes/NSString+FontAwesome.h @@ -0,0 +1,592 @@ +// +// * The Font Awesome font is licensed under the SIL Open Font License +// http://scripts.sil.org/OFL +// +// +// * Font Awesome CSS, LESS, and SASS files are licensed under the MIT License +// http://opensource.org/licenses/mit-license.html +// +// +// * The Font Awesome pictograms are licensed under the CC BY 3.0 License +// http://creativecommons.org/licenses/by/3.0 +// +// +// * Attribution is no longer required in Font Awesome 3.0, but much appreciated: +// "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import + +/** + * A string constant for the Font Awesome font family name. + */ +FOUNDATION_EXPORT NSString * const kFontAwesomeFont; + +/** + * A constant describing the available Font Awesome Icons. + */ +typedef NS_ENUM(unsigned short, FAIcon) { + FAGlass = 0xf000, + FAMusic = 0xf001, + FASearch = 0xf002, + FAEnvelopeO = 0xf003, + FAHeart = 0xf004, + FAStar = 0xf005, + FAStarO = 0xf006, + FAUser = 0xf007, + FAFilm = 0xf008, + FAThLarge = 0xf009, + FATh = 0xf00a, + FAThList = 0xf00b, + FACheck = 0xf00c, + FARemove = 0xf00d, + FAClose = 0xf00d, + FATimes = 0xf00d, + FASearchPlus = 0xf00e, + FASearchMinus = 0xf010, + FAPowerOff = 0xf011, + FASignal = 0xf012, + FAGear = 0xf013, + FACog = 0xf013, + FATrashO = 0xf014, + FAHome = 0xf015, + FAFileO = 0xf016, + FAClockO = 0xf017, + FARoad = 0xf018, + FADownload = 0xf019, + FAArrowCircleODown = 0xf01a, + FAArrowCircleOUp = 0xf01b, + FAInbox = 0xf01c, + FAPlayCircleO = 0xf01d, + FARotateRight = 0xf01e, + FARepeat = 0xf01e, + FARefresh = 0xf021, + FAListAlt = 0xf022, + FALock = 0xf023, + FAFlag = 0xf024, + FAHeadphones = 0xf025, + FAVolumeOff = 0xf026, + FAVolumeDown = 0xf027, + FAVolumeUp = 0xf028, + FAQrcode = 0xf029, + FABarcode = 0xf02a, + FATag = 0xf02b, + FATags = 0xf02c, + FABook = 0xf02d, + FABookmark = 0xf02e, + FAPrint = 0xf02f, + FACamera = 0xf030, + FAFont = 0xf031, + FABold = 0xf032, + FAItalic = 0xf033, + FATextHeight = 0xf034, + FATextWidth = 0xf035, + FAAlignLeft = 0xf036, + FAAlignCenter = 0xf037, + FAAlignRight = 0xf038, + FAAlignJustify = 0xf039, + FAList = 0xf03a, + FADedent = 0xf03b, + FAOutdent = 0xf03b, + FAIndent = 0xf03c, + FAVideoCamera = 0xf03d, + FAPhoto = 0xf03e, + FAImage = 0xf03e, + FAPictureO = 0xf03e, + FAPencil = 0xf040, + FAMapMarker = 0xf041, + FAAdjust = 0xf042, + FATint = 0xf043, + FAEdit = 0xf044, + FAPencilSquareO = 0xf044, + FAShareSquareO = 0xf045, + FACheckSquareO = 0xf046, + FAArrows = 0xf047, + FAStepBackward = 0xf048, + FAFastBackward = 0xf049, + FABackward = 0xf04a, + FAPlay = 0xf04b, + FAPause = 0xf04c, + FAStop = 0xf04d, + FAForward = 0xf04e, + FAFastForward = 0xf050, + FAStepForward = 0xf051, + FAEject = 0xf052, + FAChevronLeft = 0xf053, + FAChevronRight = 0xf054, + FAPlusCircle = 0xf055, + FAMinusCircle = 0xf056, + FATimesCircle = 0xf057, + FACheckCircle = 0xf058, + FAQuestionCircle = 0xf059, + FAInfoCircle = 0xf05a, + FACrosshairs = 0xf05b, + FATimesCircleO = 0xf05c, + FACheckCircleO = 0xf05d, + FABan = 0xf05e, + FAArrowLeft = 0xf060, + FAArrowRight = 0xf061, + FAArrowUp = 0xf062, + FAArrowDown = 0xf063, + FAMailForward = 0xf064, + FAShare = 0xf064, + FAExpand = 0xf065, + FACompress = 0xf066, + FAPlus = 0xf067, + FAMinus = 0xf068, + FAAsterisk = 0xf069, + FAExclamationCircle = 0xf06a, + FAGift = 0xf06b, + FALeaf = 0xf06c, + FAFire = 0xf06d, + FAEye = 0xf06e, + FAEyeSlash = 0xf070, + FAWarning = 0xf071, + FAExclamationTriangle = 0xf071, + FAPlane = 0xf072, + FACalendar = 0xf073, + FARandom = 0xf074, + FAComment = 0xf075, + FAMagnet = 0xf076, + FAChevronUp = 0xf077, + FAChevronDown = 0xf078, + FARetweet = 0xf079, + FAShoppingCart = 0xf07a, + FAFolder = 0xf07b, + FAFolderOpen = 0xf07c, + FAArrowsV = 0xf07d, + FAArrowsH = 0xf07e, + FABarChartO = 0xf080, + FABarChart = 0xf080, + FATwitterSquare = 0xf081, + FAFacebookSquare = 0xf082, + FACameraRetro = 0xf083, + FAKey = 0xf084, + FAGears = 0xf085, + FACogs = 0xf085, + FAComments = 0xf086, + FAThumbsOUp = 0xf087, + FAThumbsODown = 0xf088, + FAStarHalf = 0xf089, + FAHeartO = 0xf08a, + FASignOut = 0xf08b, + FALinkedinSquare = 0xf08c, + FAThumbTack = 0xf08d, + FAExternalLink = 0xf08e, + FASignIn = 0xf090, + FATrophy = 0xf091, + FAGithubSquare = 0xf092, + FAUpload = 0xf093, + FALemonO = 0xf094, + FAPhone = 0xf095, + FASquareO = 0xf096, + FABookmarkO = 0xf097, + FAPhoneSquare = 0xf098, + FATwitter = 0xf099, + FAFacebook = 0xf09a, + FAGithub = 0xf09b, + FAUnlock = 0xf09c, + FACreditCard = 0xf09d, + FARss = 0xf09e, + FAHddO = 0xf0a0, + FABullhorn = 0xf0a1, + FABell = 0xf0f3, + FACertificate = 0xf0a3, + FAHandORight = 0xf0a4, + FAHandOLeft = 0xf0a5, + FAHandOUp = 0xf0a6, + FAHandODown = 0xf0a7, + FAArrowCircleLeft = 0xf0a8, + FAArrowCircleRight = 0xf0a9, + FAArrowCircleUp = 0xf0aa, + FAArrowCircleDown = 0xf0ab, + FAGlobe = 0xf0ac, + FAWrench = 0xf0ad, + FATasks = 0xf0ae, + FAFilter = 0xf0b0, + FABriefcase = 0xf0b1, + FAArrowsAlt = 0xf0b2, + FAGroup = 0xf0c0, + FAUsers = 0xf0c0, + FAChain = 0xf0c1, + FALink = 0xf0c1, + FACloud = 0xf0c2, + FAFlask = 0xf0c3, + FACut = 0xf0c4, + FAScissors = 0xf0c4, + FACopy = 0xf0c5, + FAFilesO = 0xf0c5, + FAPaperclip = 0xf0c6, + FASave = 0xf0c7, + FAFloppyO = 0xf0c7, + FASquare = 0xf0c8, + FANavicon = 0xf0c9, + FAReorder = 0xf0c9, + FABars = 0xf0c9, + FAListUl = 0xf0ca, + FAListOl = 0xf0cb, + FAStrikethrough = 0xf0cc, + FAUnderline = 0xf0cd, + FATable = 0xf0ce, + FAMagic = 0xf0d0, + FATruck = 0xf0d1, + FAPinterest = 0xf0d2, + FAPinterestSquare = 0xf0d3, + FAGooglePlusSquare = 0xf0d4, + FAGooglePlus = 0xf0d5, + FAMoney = 0xf0d6, + FACaretDown = 0xf0d7, + FACaretUp = 0xf0d8, + FACaretLeft = 0xf0d9, + FACaretRight = 0xf0da, + FAColumns = 0xf0db, + FAUnsorted = 0xf0dc, + FASort = 0xf0dc, + FASortDown = 0xf0dd, + FASortDesc = 0xf0dd, + FASortUp = 0xf0de, + FASortAsc = 0xf0de, + FAEnvelope = 0xf0e0, + FALinkedin = 0xf0e1, + FARotateLeft = 0xf0e2, + FAUndo = 0xf0e2, + FALegal = 0xf0e3, + FAGavel = 0xf0e3, + FADashboard = 0xf0e4, + FATachometer = 0xf0e4, + FACommentO = 0xf0e5, + FACommentsO = 0xf0e6, + FAFlash = 0xf0e7, + FABolt = 0xf0e7, + FASitemap = 0xf0e8, + FAUmbrella = 0xf0e9, + FAPaste = 0xf0ea, + FAClipboard = 0xf0ea, + FALightbulbO = 0xf0eb, + FAExchange = 0xf0ec, + FACloudDownload = 0xf0ed, + FACloudUpload = 0xf0ee, + FAUserMd = 0xf0f0, + FAStethoscope = 0xf0f1, + FASuitcase = 0xf0f2, + FABellO = 0xf0a2, + FACoffee = 0xf0f4, + FACutlery = 0xf0f5, + FAFileTextO = 0xf0f6, + FABuildingO = 0xf0f7, + FAHospitalO = 0xf0f8, + FAAmbulance = 0xf0f9, + FAMedkit = 0xf0fa, + FAFighterJet = 0xf0fb, + FABeer = 0xf0fc, + FAHSquare = 0xf0fd, + FAPlusSquare = 0xf0fe, + FAAngleDoubleLeft = 0xf100, + FAAngleDoubleRight = 0xf101, + FAAngleDoubleUp = 0xf102, + FAAngleDoubleDown = 0xf103, + FAAngleLeft = 0xf104, + FAAngleRight = 0xf105, + FAAngleUp = 0xf106, + FAAngleDown = 0xf107, + FADesktop = 0xf108, + FALaptop = 0xf109, + FATablet = 0xf10a, + FAMobilePhone = 0xf10b, + FAMobile = 0xf10b, + FACircleO = 0xf10c, + FAQuoteLeft = 0xf10d, + FAQuoteRight = 0xf10e, + FASpinner = 0xf110, + FACircle = 0xf111, + FAMailReply = 0xf112, + FAReply = 0xf112, + FAGithubAlt = 0xf113, + FAFolderO = 0xf114, + FAFolderOpenO = 0xf115, + FASmileO = 0xf118, + FAFrownO = 0xf119, + FAMehO = 0xf11a, + FAGamepad = 0xf11b, + FAKeyboardO = 0xf11c, + FAFlagO = 0xf11d, + FAFlagCheckered = 0xf11e, + FATerminal = 0xf120, + FACode = 0xf121, + FAMailReplyAll = 0xf122, + FAReplyAll = 0xf122, + FAStarHalfEmpty = 0xf123, + FAStarHalfFull = 0xf123, + FAStarHalfO = 0xf123, + FALocationArrow = 0xf124, + FACrop = 0xf125, + FACodeFork = 0xf126, + FAUnlink = 0xf127, + FAChainBroken = 0xf127, + FAQuestion = 0xf128, + FAInfo = 0xf129, + FAExclamation = 0xf12a, + FASuperscript = 0xf12b, + FASubscript = 0xf12c, + FAEraser = 0xf12d, + FAPuzzlePiece = 0xf12e, + FAMicrophone = 0xf130, + FAMicrophoneSlash = 0xf131, + FAShield = 0xf132, + FACalendarO = 0xf133, + FAFireExtinguisher = 0xf134, + FARocket = 0xf135, + FAMaxcdn = 0xf136, + FAChevronCircleLeft = 0xf137, + FAChevronCircleRight = 0xf138, + FAChevronCircleUp = 0xf139, + FAChevronCircleDown = 0xf13a, + FAHtml5 = 0xf13b, + FACss3 = 0xf13c, + FAAnchor = 0xf13d, + FAUnlockAlt = 0xf13e, + FABullseye = 0xf140, + FAEllipsisH = 0xf141, + FAEllipsisV = 0xf142, + FARssSquare = 0xf143, + FAPlayCircle = 0xf144, + FATicket = 0xf145, + FAMinusSquare = 0xf146, + FAMinusSquareO = 0xf147, + FALevelUp = 0xf148, + FALevelDown = 0xf149, + FACheckSquare = 0xf14a, + FAPencilSquare = 0xf14b, + FAExternalLinkSquare = 0xf14c, + FAShareSquare = 0xf14d, + FACompass = 0xf14e, + FAToggleDown = 0xf150, + FACaretSquareODown = 0xf150, + FAToggleUp = 0xf151, + FACaretSquareOUp = 0xf151, + FAToggleRight = 0xf152, + FACaretSquareORight = 0xf152, + FAEuro = 0xf153, + FAEur = 0xf153, + FAGbp = 0xf154, + FADollar = 0xf155, + FAUsd = 0xf155, + FARupee = 0xf156, + FAInr = 0xf156, + FACny = 0xf157, + FARmb = 0xf157, + FAYen = 0xf157, + FAJpy = 0xf157, + FARuble = 0xf158, + FARouble = 0xf158, + FARub = 0xf158, + FAWon = 0xf159, + FAKrw = 0xf159, + FABitcoin = 0xf15a, + FABtc = 0xf15a, + FAFile = 0xf15b, + FAFileText = 0xf15c, + FASortAlphaAsc = 0xf15d, + FASortAlphaDesc = 0xf15e, + FASortAmountAsc = 0xf160, + FASortAmountDesc = 0xf161, + FASortNumericAsc = 0xf162, + FASortNumericDesc = 0xf163, + FAThumbsUp = 0xf164, + FAThumbsDown = 0xf165, + FAYoutubeSquare = 0xf166, + FAYoutube = 0xf167, + FAXing = 0xf168, + FAXingSquare = 0xf169, + FAYoutubePlay = 0xf16a, + FADropbox = 0xf16b, + FAStackOverflow = 0xf16c, + FAInstagram = 0xf16d, + FAFlickr = 0xf16e, + FAAdn = 0xf170, + FABitbucket = 0xf171, + FABitbucketSquare = 0xf172, + FATumblr = 0xf173, + FATumblrSquare = 0xf174, + FALongArrowDown = 0xf175, + FALongArrowUp = 0xf176, + FALongArrowLeft = 0xf177, + FALongArrowRight = 0xf178, + FAApple = 0xf179, + FAWindows = 0xf17a, + FAAndroid = 0xf17b, + FALinux = 0xf17c, + FADribbble = 0xf17d, + FASkype = 0xf17e, + FAFoursquare = 0xf180, + FATrello = 0xf181, + FAFemale = 0xf182, + FAMale = 0xf183, + FAGittip = 0xf184, + FASunO = 0xf185, + FAMoonO = 0xf186, + FAArchive = 0xf187, + FABug = 0xf188, + FAVk = 0xf189, + FAWeibo = 0xf18a, + FARenren = 0xf18b, + FAPagelines = 0xf18c, + FAStackExchange = 0xf18d, + FAArrowCircleORight = 0xf18e, + FAArrowCircleOLeft = 0xf190, + FAToggleLeft = 0xf191, + FACaretSquareOLeft = 0xf191, + FADotCircleO = 0xf192, + FAWheelchair = 0xf193, + FAVimeoSquare = 0xf194, + FATurkishLira = 0xf195, + FATry = 0xf195, + FAPlusSquareO = 0xf196, + FASpaceShuttle = 0xf197, + FASlack = 0xf198, + FAEnvelopeSquare = 0xf199, + FAWordpress = 0xf19a, + FAOpenid = 0xf19b, + FAInstitution = 0xf19c, + FABank = 0xf19c, + FAUniversity = 0xf19c, + FAMortarBoard = 0xf19d, + FAGraduationCap = 0xf19d, + FAYahoo = 0xf19e, + FAGoogle = 0xf1a0, + FAReddit = 0xf1a1, + FARedditSquare = 0xf1a2, + FAStumbleuponCircle = 0xf1a3, + FAStumbleupon = 0xf1a4, + FADelicious = 0xf1a5, + FADigg = 0xf1a6, + FAPiedPiper = 0xf1a7, + FAPiedPiperAlt = 0xf1a8, + FADrupal = 0xf1a9, + FAJoomla = 0xf1aa, + FALanguage = 0xf1ab, + FAFax = 0xf1ac, + FABuilding = 0xf1ad, + FAChild = 0xf1ae, + FAPaw = 0xf1b0, + FASpoon = 0xf1b1, + FACube = 0xf1b2, + FACubes = 0xf1b3, + FABehance = 0xf1b4, + FABehanceSquare = 0xf1b5, + FASteam = 0xf1b6, + FASteamSquare = 0xf1b7, + FARecycle = 0xf1b8, + FAAutomobile = 0xf1b9, + FACar = 0xf1b9, + FACab = 0xf1ba, + FATaxi = 0xf1ba, + FATree = 0xf1bb, + FASpotify = 0xf1bc, + FADeviantart = 0xf1bd, + FASoundcloud = 0xf1be, + FADatabase = 0xf1c0, + FAFilePdfO = 0xf1c1, + FAFileWordO = 0xf1c2, + FAFileExcelO = 0xf1c3, + FAFilePowerpointO = 0xf1c4, + FAFilePhotoO = 0xf1c5, + FAFilePictureO = 0xf1c5, + FAFileImageO = 0xf1c5, + FAFileZipO = 0xf1c6, + FAFileArchiveO = 0xf1c6, + FAFileSoundO = 0xf1c7, + FAFileAudioO = 0xf1c7, + FAFileMovieO = 0xf1c8, + FAFileVideoO = 0xf1c8, + FAFileCodeO = 0xf1c9, + FAVine = 0xf1ca, + FACodepen = 0xf1cb, + FAJsfiddle = 0xf1cc, + FALifeBouy = 0xf1cd, + FALifeBuoy = 0xf1cd, + FALifeSaver = 0xf1cd, + FASupport = 0xf1cd, + FALifeRing = 0xf1cd, + FACircleONotch = 0xf1ce, + FARa = 0xf1d0, + FARebel = 0xf1d0, + FAGe = 0xf1d1, + FAEmpire = 0xf1d1, + FAGitSquare = 0xf1d2, + FAGit = 0xf1d3, + FAHackerNews = 0xf1d4, + FATencentWeibo = 0xf1d5, + FAQq = 0xf1d6, + FAWechat = 0xf1d7, + FAWeixin = 0xf1d7, + FASend = 0xf1d8, + FAPaperPlane = 0xf1d8, + FASendO = 0xf1d9, + FAPaperPlaneO = 0xf1d9, + FAHistory = 0xf1da, + FACircleThin = 0xf1db, + FAHeader = 0xf1dc, + FAParagraph = 0xf1dd, + FASliders = 0xf1de, + FAShareAlt = 0xf1e0, + FAShareAltSquare = 0xf1e1, + FABomb = 0xf1e2, + FASoccerBallO = 0xf1e3, + FAFutbolO = 0xf1e3, + FATty = 0xf1e4, + FABinoculars = 0xf1e5, + FAPlug = 0xf1e6, + FASlideshare = 0xf1e7, + FATwitch = 0xf1e8, + FAYelp = 0xf1e9, + FANewspaperO = 0xf1ea, + FAWifi = 0xf1eb, + FACalculator = 0xf1ec, + FAPaypal = 0xf1ed, + FAGoogleWallet = 0xf1ee, + FACcVisa = 0xf1f0, + FACcMastercard = 0xf1f1, + FACcDiscover = 0xf1f2, + FACcAmex = 0xf1f3, + FACcPaypal = 0xf1f4, + FACcStripe = 0xf1f5, + FABellSlash = 0xf1f6, + FABellSlashO = 0xf1f7, + FATrash = 0xf1f8, + FACopyright = 0xf1f9, + FAAt = 0xf1fa, + FAEyedropper = 0xf1fb, + FAPaintBrush = 0xf1fc, + FABirthdayCake = 0xf1fd, + FAAreaChart = 0xf1fe, + FAPieChart = 0xf200, + FALineChart = 0xf201, + FALastfm = 0xf202, + FALastfmSquare = 0xf203, + FAToggleOff = 0xf204, + FAToggleOn = 0xf205, + FABicycle = 0xf206, + FABus = 0xf207, + FAIoxhost = 0xf208, + FAAngellist = 0xf209, + FACc = 0xf20a, + FAShekel = 0xf20b, + FASheqel = 0xf20b, + FAIls = 0xf20b, + FAMeanpath = 0xf20c +}; + +@interface NSString (FontAwesome) + ++ (NSString *)fa_stringForFontAwesomeIcon:(FAIcon)icon; + +@end \ No newline at end of file diff --git a/BButton/Classes/NSString+FontAwesome.m b/BButton/Classes/NSString+FontAwesome.m new file mode 100644 index 0000000..b025c8d --- /dev/null +++ b/BButton/Classes/NSString+FontAwesome.m @@ -0,0 +1,37 @@ +// +// * The Font Awesome font is licensed under the SIL Open Font License +// http://scripts.sil.org/OFL +// +// +// * Font Awesome CSS, LESS, and SASS files are licensed under the MIT License +// http://opensource.org/licenses/mit-license.html +// +// +// * The Font Awesome pictograms are licensed under the CC BY 3.0 License +// http://creativecommons.org/licenses/by/3.0 +// +// +// * Attribution is no longer required in Font Awesome 3.0, but much appreciated: +// "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import "NSString+FontAwesome.h" + +NSString * const kFontAwesomeFont = @"FontAwesome"; + +@implementation NSString (FontAwesome) + ++ (NSString *)fa_stringForFontAwesomeIcon:(FAIcon)icon +{ + return [NSString stringWithFormat:@"%C", icon]; +} + +@end \ No newline at end of file diff --git a/BButton/Classes/UIColor+BButton.h b/BButton/Classes/UIColor+BButton.h new file mode 100644 index 0000000..0620b86 --- /dev/null +++ b/BButton/Classes/UIColor+BButton.h @@ -0,0 +1,59 @@ +// +// Created by Mathieu Bolard on 31/07/12. +// Copyright (c) 2012 Mathieu Bolard. All rights reserved. +// +// https://github.com/mattlawer/BButton +// +// +// BButton is licensed under the MIT license +// http://opensource.org/licenses/MIT +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import + +@interface UIColor (BButton) + +#pragma mark - Custom colors + ++ (UIColor *)bb_defaultColorV2; ++ (UIColor *)bb_defaultColorV3; + ++ (UIColor *)bb_primaryColorV2; ++ (UIColor *)bb_primaryColorV3; + ++ (UIColor *)bb_infoColorV2; ++ (UIColor *)bb_infoColorV3; + ++ (UIColor *)bb_successColorV2; ++ (UIColor *)bb_successColorV3; + ++ (UIColor *)bb_warningColorV2; ++ (UIColor *)bb_warningColorV3; + ++ (UIColor *)bb_dangerColorV2; ++ (UIColor *)bb_dangerColorV3; + ++ (UIColor *)bb_inverseColorV2; ++ (UIColor *)bb_inverseColorV3; + ++ (UIColor *)bb_twitterColor; ++ (UIColor *)bb_facebookColor; ++ (UIColor *)bb_purpleBButtonColor; ++ (UIColor *)bb_grayBButtonColor; + +#pragma mark - Utilities + +- (UIColor *)bb_desaturatedColorToPercentSaturation:(CGFloat)percent; +- (UIColor *)bb_lightenColorWithValue:(CGFloat)value; +- (UIColor *)bb_darkenColorWithValue:(CGFloat)value; +- (BOOL)bb_isLightColor; + +@end \ No newline at end of file diff --git a/BButton/Classes/UIColor+BButton.m b/BButton/Classes/UIColor+BButton.m new file mode 100644 index 0000000..c7545b6 --- /dev/null +++ b/BButton/Classes/UIColor+BButton.m @@ -0,0 +1,205 @@ +// +// Created by Mathieu Bolard on 31/07/12. +// Copyright (c) 2012 Mathieu Bolard. All rights reserved. +// +// https://github.com/mattlawer/BButton +// +// +// BButton is licensed under the MIT license +// http://opensource.org/licenses/MIT +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import "UIColor+BButton.h" + +@implementation UIColor (BButton) + +#pragma mark - Custom colors + ++ (UIColor *)bb_defaultColorV2 +{ + return [UIColor colorWithRed:0.85f green:0.85f blue:0.85f alpha:1.00f]; +} + ++ (UIColor *)bb_defaultColorV3 +{ + return [UIColor colorWithHue:0.0f saturation:0.0f brightness:1.0f alpha:1.0f]; +} + ++ (UIColor *)bb_primaryColorV2 +{ + return [UIColor colorWithRed:0.00f green:0.33f blue:0.80f alpha:1.00f]; +} + ++ (UIColor *)bb_primaryColorV3 +{ + return [UIColor colorWithHue:208.0f/360.0f saturation:0.72f brightness:0.69f alpha:1.0f]; +} + ++ (UIColor *)bb_infoColorV2 +{ + return [UIColor colorWithRed:0.18f green:0.59f blue:0.71f alpha:1.00f]; +} + ++ (UIColor *)bb_infoColorV3 +{ + return [UIColor colorWithHue:194.0f/360.0f saturation:0.59f brightness:0.87f alpha:1.0f]; +} + ++ (UIColor *)bb_successColorV2 +{ + return [UIColor colorWithRed:0.32f green:0.64f blue:0.32f alpha:1.00f]; +} + ++ (UIColor *)bb_successColorV3 +{ + return [UIColor colorWithHue:120.0f/360.0f saturation:0.50f brightness:0.72f alpha:1.0f]; +} + ++ (UIColor *)bb_warningColorV2 +{ + return [UIColor colorWithRed:0.97f green:0.58f blue:0.02f alpha:1.00f]; +} + ++ (UIColor *)bb_warningColorV3 +{ + return [UIColor colorWithHue:35.0f/360.0f saturation:0.68f brightness:0.94f alpha:1.0f]; +} + ++ (UIColor *)bb_dangerColorV2 +{ + return [UIColor colorWithRed:0.74f green:0.21f blue:0.18f alpha:1.00f]; +} + ++ (UIColor *)bb_dangerColorV3 +{ + return [UIColor colorWithHue:2.0f/360.0f saturation:0.64f brightness:0.85f alpha:1.0f]; +} + ++ (UIColor *)bb_inverseColorV2 +{ + return [UIColor colorWithRed:0.13f green:0.13f blue:0.13f alpha:1.00f]; +} + ++ (UIColor *)bb_inverseColorV3 +{ + return [UIColor colorWithHue:0.0f saturation:0.0f brightness:0.75f alpha:1.0f]; +} + ++ (UIColor *)bb_twitterColor +{ + return [UIColor colorWithRed:0.25f green:0.60f blue:1.00f alpha:1.00f]; +} + ++ (UIColor *)bb_facebookColor +{ + return [UIColor colorWithRed:0.23f green:0.35f blue:0.60f alpha:1.00f]; +} + ++ (UIColor *)bb_purpleBButtonColor +{ + return [UIColor colorWithRed:0.45f green:0.30f blue:0.75f alpha:1.00f]; +} + ++ (UIColor *)bb_grayBButtonColor +{ + return [UIColor colorWithRed:0.60f green:0.60f blue:0.60f alpha:1.00f]; +} + +#pragma mark - Utilities + +- (UIColor *)bb_desaturatedColorToPercentSaturation:(CGFloat)percent +{ + CGFloat h, s, b, a; + [self getHue:&h saturation:&s brightness:&b alpha:&a]; + return [UIColor colorWithHue:h saturation:s * percent brightness:b alpha:a]; +} + +- (UIColor *)bb_lightenColorWithValue:(CGFloat)value +{ + NSUInteger totalComponents = CGColorGetNumberOfComponents(self.CGColor); + BOOL isGreyscale = (totalComponents == 2) ? YES : NO; + + CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.CGColor); + CGFloat newComponents[4]; + + if(isGreyscale) { + newComponents[0] = oldComponents[0] + value > 1.0f ? 1.0f : oldComponents[0] + value; + newComponents[1] = oldComponents[0] + value > 1.0f ? 1.0f : oldComponents[0] + value; + newComponents[2] = oldComponents[0] + value > 1.0f ? 1.0f : oldComponents[0] + value; + newComponents[3] = oldComponents[1]; + } + else { + newComponents[0] = oldComponents[0] + value > 1.0f ? 1.0f : oldComponents[0] + value; + newComponents[1] = oldComponents[1] + value > 1.0f ? 1.0f : oldComponents[1] + value; + newComponents[2] = oldComponents[2] + value > 1.0f ? 1.0f : oldComponents[2] + value; + newComponents[3] = oldComponents[3]; + } + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGColorRef newColor = CGColorCreate(colorSpace, newComponents); + CGColorSpaceRelease(colorSpace); + + UIColor *retColor = [UIColor colorWithCGColor:newColor]; + CGColorRelease(newColor); + + return retColor; +} + +- (UIColor *)bb_darkenColorWithValue:(CGFloat)value +{ + NSUInteger totalComponents = CGColorGetNumberOfComponents(self.CGColor); + BOOL isGreyscale = (totalComponents == 2) ? YES : NO; + + CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.CGColor); + CGFloat newComponents[4]; + + if(isGreyscale) { + newComponents[0] = oldComponents[0] - value < 0.0f ? 0.0f : oldComponents[0] - value; + newComponents[1] = oldComponents[0] - value < 0.0f ? 0.0f : oldComponents[0] - value; + newComponents[2] = oldComponents[0] - value < 0.0f ? 0.0f : oldComponents[0] - value; + newComponents[3] = oldComponents[1]; + } + else { + newComponents[0] = oldComponents[0] - value < 0.0f ? 0.0f : oldComponents[0] - value; + newComponents[1] = oldComponents[1] - value < 0.0f ? 0.0f : oldComponents[1] - value; + newComponents[2] = oldComponents[2] - value < 0.0f ? 0.0f : oldComponents[2] - value; + newComponents[3] = oldComponents[3]; + } + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGColorRef newColor = CGColorCreate(colorSpace, newComponents); + CGColorSpaceRelease(colorSpace); + + UIColor *retColor = [UIColor colorWithCGColor:newColor]; + CGColorRelease(newColor); + + return retColor; +} + +- (BOOL)bb_isLightColor +{ + NSUInteger totalComponents = CGColorGetNumberOfComponents(self.CGColor); + BOOL isGreyscale = (totalComponents == 2) ? YES : NO; + + CGFloat *components = (CGFloat *)CGColorGetComponents(self.CGColor); + CGFloat sum; + + if(isGreyscale) { + sum = components[0]; + } + else { + sum = (components[0] + components[1] + components[2]) / 3.0f; + } + + return (sum >= 0.75f); +} + +@end \ No newline at end of file diff --git a/BButton/NSString+FontAwesome.h b/BButton/NSString+FontAwesome.h deleted file mode 100644 index fa0b7a0..0000000 --- a/BButton/NSString+FontAwesome.h +++ /dev/null @@ -1,256 +0,0 @@ -// -// NSString+FontAwesome.h -// -// Created by Pit Garbe on 27.09.12. -// Copyright (c) 2012 Pit Garbe. All rights reserved. -// -// https://github.com/leberwurstsaft/FontAwesome-for-iOS -// -// -// * The Font Awesome font is licensed under the SIL Open Font License -// http://scripts.sil.org/OFL -// -// -// * Font Awesome CSS, LESS, and SASS files are licensed under the MIT License -// http://opensource.org/licenses/mit-license.html -// -// -// * The Font Awesome pictograms are licensed under the CC BY 3.0 License -// http://creativecommons.org/licenses/by/3.0 -// -// -// * Attribution is no longer required in Font Awesome 3.0, but much appreciated: -// "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" -// -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import - -typedef enum { - FAIconGlass = 0, - FAIconMusic, - FAIconSearch, - FAIconEnvelope, - FAIconHeart, - FAIconStar, - FAIconStarEmpty, - FAIconUser, - FAIconFilm, - FAIconThLarge, - FAIconTh, - FAIconThList, - FAIconOk, - FAIconRemove, - FAIconZoomIn, - FAIconZoomOut, - FAIconOff, - FAIconSignal, - FAIconCog, - FAIconTrash, - FAIconHome, - FAIconFile, - FAIconTime, - FAIconRoad, - FAIconDownloadAlt, - FAIconDownload, - FAIconUpload, - FAIconInbox, - FAIconPlayCircle, - FAIconRepeat, - FAIconRefresh, - FAIconListAlt, - FAIconLock, - FAIconFlag, - FAIconHeadphones, - FAIconVolumeOff, - FAIconVolumeDown, - FAIconVolumeUp, - FAIconQrcode, - FAIconBarcode, - FAIconTag, - FAIconTags, - FAIconBook, - FAIconBookmark, - FAIconPrint, - FAIconCamera, - FAIconFont, - FAIconBold, - FAIconItalic, - FAIconTextHeight, - FAIconTextWidth, - FAIconAlignLeft, - FAIconAlignCenter, - FAIconAlignRight, - FAIconAlignJustify, - FAIconList, - FAIconIndentLeft, - FAIconIndentRight, - FAIconFacetimeVideo, - FAIconPicture, - FAIconPencil, - FAIconMapMarker, - FAIconAdjust, - FAIconTint, - FAIconEdit, - FAIconShare, - FAIconCheck, - FAIconMove, - FAIconStepBackward, - FAIconFastBackward, - FAIconBackward, - FAIconPlay, - FAIconPause, - FAIconStop, - FAIconForward, - FAIconFastForward, - FAIconStepForward, - FAIconEject, - FAIconChevronLeft, - FAIconChevronRight, - FAIconPlusSign, - FAIconMinusSign, - FAIconRemoveSign, - FAIconOkSign, - FAIconQuestionSign, - FAIconInfoSign, - FAIconScreenshot, - FAIconRemoveCircle, - FAIconOkCircle, - FAIconBanCircle, - FAIconArrowLeft, - FAIconArrowRight, - FAIconArrowUp, - FAIconArrowDown, - FAIconShareAlt, - FAIconResizeFull, - FAIconResizeSmall, - FAIconPlus, - FAIconMinus, - FAIconAsterisk, - FAIconExclamationSign, - FAIconGift, - FAIconLeaf, - FAIconFire, - FAIconEyeOpen, - FAIconEyeClose, - FAIconWarningSign, - FAIconPlane, - FAIconCalendar, - FAIconRandom, - FAIconComment, - FAIconMagnet, - FAIconChevronUp, - FAIconChevronDown, - FAIconRetweet, - FAIconShoppingCart, - FAIconFolderClose, - FAIconFolderOpen, - FAIconResizeVertical, - FAIconResizeHorizontal, - FAIconBarChart, - FAIconTwitterSign, - FAIconFacebookSign, - FAIconCameraRetro, - FAIconKey, - FAIconCogs, - FAIconComments, - FAIconThumbsUp, - FAIconThumbsDown, - FAIconStarHalf, - FAIconHeartEmpty, - FAIconSignout, - FAIconLinkedinSign, - FAIconPushpin, - FAIconExternalLink, - FAIconSignin, - FAIconTrophy, - FAIconGithubSign, - FAIconUploadAlt, - FAIconLemon, - FAIconPhone, - FAIconCheckEmpty, - FAIconBookmarkEmpty, - FAIconPhoneSign, - FAIconTwitter, - FAIconFacebook, - FAIconGithub, - FAIconUnlock, - FAIconCreditCard, - FAIconRss, - FAIconHdd, - FAIconBullhorn, - FAIconBell, - FAIconCertificate, - FAIconHandRight, - FAIconHandLeft, - FAIconHandUp, - FAIconHandDown, - FAIconCircleArrowLeft, - FAIconCircleArrowRight, - FAIconCircleArrowUp, - FAIconCircleArrowDown, - FAIconGlobe, - FAIconWrench, - FAIconTasks, - FAIconFilter, - FAIconBriefcase, - FAIconFullscreen, - FAIconGroup, - FAIconLink, - FAIconCloud, - FAIconBeaker, - FAIconCut, - FAIconCopy, - FAIconPaperClip, - FAIconSave, - FAIconSignBlank, - FAIconReorder, - FAIconListUl, - FAIconListOl, - FAIconStrikethrough, - FAIconUnderline, - FAIconTable, - FAIconMagic, - FAIconTruck, - FAIconPinterest, - FAIconPinterestSign, - FAIconGooglePlusSign, - FAIconGooglePlus, - FAIconMoney, - FAIconCaretDown, - FAIconCaretUp, - FAIconCaretLeft, - FAIconCaretRight, - FAIconColumns, - FAIconSort, - FAIconSortDown, - FAIconSortUp, - FAIconEnvelopeAlt, - FAIconLinkedin, - FAIconUndo, - FAIconLegal, - FAIconDashboard, - FAIconCommentAlt, - FAIconCommentsAlt, - FAIconBolt, - FAIconSitemap, - FAIconUmbrella, - FAIconPaste, - FAIconUserMd -} FAIcon; - - -@interface NSString (FontAwesome) - -+ (NSString *)stringFromAwesomeIcon:(FAIcon)icon; -- (NSString *)trimWhitespace; -- (BOOL)isEmpty; - -@end \ No newline at end of file diff --git a/BButton/NSString+FontAwesome.m b/BButton/NSString+FontAwesome.m deleted file mode 100644 index 4474d63..0000000 --- a/BButton/NSString+FontAwesome.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// NSString+FontAwesome.m -// -// Created by Pit Garbe on 27.09.12. -// Copyright (c) 2012 Pit Garbe. All rights reserved. -// -// https://github.com/leberwurstsaft/FontAwesome-for-iOS -// -// -// * The Font Awesome font is licensed under the SIL Open Font License -// http://scripts.sil.org/OFL -// -// -// * Font Awesome CSS, LESS, and SASS files are licensed under the MIT License -// http://opensource.org/licenses/mit-license.html -// -// -// * The Font Awesome pictograms are licensed under the CC BY 3.0 License -// http://creativecommons.org/licenses/by/3.0 -// -// -// * Attribution is no longer required in Font Awesome 3.0, but much appreciated: -// "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" -// -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import "NSString+FontAwesome.h" - -static const NSArray *awesomeStrings; - - -@implementation NSString (FontAwesome) - -+ (NSString *)stringFromAwesomeIcon:(FAIcon)icon -{ - if(!awesomeStrings) { - awesomeStrings = [NSArray arrayWithObjects:@"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", nil]; - } - - return [awesomeStrings objectAtIndex:icon]; -} - -- (NSString *)trimWhitespace -{ - NSMutableString *str = [self mutableCopy]; - CFStringTrimWhitespace((__bridge CFMutableStringRef)str); - return str; -} - -- (BOOL)isEmpty -{ - return [[self trimWhitespace] isEqualToString:@""]; -} - -@end \ No newline at end of file diff --git a/BButton/UIColor+BButton.h b/BButton/UIColor+BButton.h deleted file mode 100644 index 3b87b51..0000000 --- a/BButton/UIColor+BButton.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// UIColor+BButton.h -// -// Created by Mathieu Bolard on 31/07/12. -// Copyright (c) 2012 Mathieu Bolard. All rights reserved. -// -// https://github.com/mattlawer/BButton -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import - -@interface UIColor (BButton) - -- (UIColor *)lightenColorWithValue:(CGFloat)value; -- (UIColor *)darkenColorWithValue:(CGFloat)value; -- (BOOL)isLightColor; - -@end \ No newline at end of file diff --git a/BButton/UIColor+BButton.m b/BButton/UIColor+BButton.m deleted file mode 100644 index 7ae8685..0000000 --- a/BButton/UIColor+BButton.m +++ /dev/null @@ -1,122 +0,0 @@ -// -// UIColor+BButton.m -// -// Created by Mathieu Bolard on 31/07/12. -// Copyright (c) 2012 Mathieu Bolard. All rights reserved. -// -// https://github.com/mattlawer/BButton -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------- -// Edited and refactored by Jesse Squires on 2 April, 2013. -// -// http://github.com/jessesquires/BButton -// -// http://hexedbits.com -// - -#import "UIColor+BButton.h" - -@implementation UIColor (BButton) - -- (UIColor *)lightenColorWithValue:(CGFloat)value -{ - int totalComponents = CGColorGetNumberOfComponents(self.CGColor); - BOOL isGreyscale = (totalComponents == 2) ? YES : NO; - - CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.CGColor); - CGFloat newComponents[4]; - - if(isGreyscale) { - newComponents[0] = oldComponents[0] + value > 1.0 ? 1.0 : oldComponents[0] + value; - newComponents[1] = oldComponents[0] + value > 1.0 ? 1.0 : oldComponents[0] + value; - newComponents[2] = oldComponents[0] + value > 1.0 ? 1.0 : oldComponents[0] + value; - newComponents[3] = oldComponents[1]; - } - else { - newComponents[0] = oldComponents[0] + value > 1.0 ? 1.0 : oldComponents[0] + value; - newComponents[1] = oldComponents[1] + value > 1.0 ? 1.0 : oldComponents[1] + value; - newComponents[2] = oldComponents[2] + value > 1.0 ? 1.0 : oldComponents[2] + value; - newComponents[3] = oldComponents[3]; - } - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGColorRef newColor = CGColorCreate(colorSpace, newComponents); - CGColorSpaceRelease(colorSpace); - - UIColor *retColor = [UIColor colorWithCGColor:newColor]; - CGColorRelease(newColor); - - return retColor; -} - -- (UIColor *)darkenColorWithValue:(CGFloat)value -{ - int totalComponents = CGColorGetNumberOfComponents(self.CGColor); - BOOL isGreyscale = (totalComponents == 2) ? YES : NO; - - CGFloat *oldComponents = (CGFloat *)CGColorGetComponents(self.CGColor); - CGFloat newComponents[4]; - - if(isGreyscale) { - newComponents[0] = oldComponents[0] - value < 0.0 ? 0.0 : oldComponents[0] - value; - newComponents[1] = oldComponents[0] - value < 0.0 ? 0.0 : oldComponents[0] - value; - newComponents[2] = oldComponents[0] - value < 0.0 ? 0.0 : oldComponents[0] - value; - newComponents[3] = oldComponents[1]; - } - else { - newComponents[0] = oldComponents[0] - value < 0.0 ? 0.0 : oldComponents[0] - value; - newComponents[1] = oldComponents[1] - value < 0.0 ? 0.0 : oldComponents[1] - value; - newComponents[2] = oldComponents[2] - value < 0.0 ? 0.0 : oldComponents[2] - value; - newComponents[3] = oldComponents[3]; - } - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGColorRef newColor = CGColorCreate(colorSpace, newComponents); - CGColorSpaceRelease(colorSpace); - - UIColor *retColor = [UIColor colorWithCGColor:newColor]; - CGColorRelease(newColor); - - return retColor; -} - -- (BOOL)isLightColor -{ - int totalComponents = CGColorGetNumberOfComponents(self.CGColor); - BOOL isGreyscale = (totalComponents == 2) ? YES : NO; - - CGFloat *components = (CGFloat *)CGColorGetComponents(self.CGColor); - CGFloat sum; - - if(isGreyscale) { - sum = components[0]; - } - else { - sum = (components[0] + components[1] + components[2]) / 3.0f; - } - - return (sum > 0.8f); -} - -@end \ No newline at end of file diff --git a/BButton/resources/FontAwesome.ttf b/BButton/resources/FontAwesome.ttf index 073abe0..96a3639 100644 Binary files a/BButton/resources/FontAwesome.ttf and b/BButton/resources/FontAwesome.ttf differ diff --git a/BButtonDemo.xcodeproj/project.pbxproj b/BButtonDemo.xcodeproj/project.pbxproj index c590b0f..e3085fa 100644 --- a/BButtonDemo.xcodeproj/project.pbxproj +++ b/BButtonDemo.xcodeproj/project.pbxproj @@ -7,150 +7,211 @@ objects = { /* Begin PBXBuildFile section */ - 880EED34170B33B000462214 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 880EED33170B33B000462214 /* UIKit.framework */; }; - 880EED36170B33B000462214 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 880EED35170B33B000462214 /* Foundation.framework */; }; - 880EED3E170B33B000462214 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 880EED3C170B33B000462214 /* InfoPlist.strings */; }; - 880EED40170B33B000462214 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EED3F170B33B000462214 /* main.m */; }; - 880EED44170B33B000462214 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EED43170B33B000462214 /* AppDelegate.m */; }; - 880EED46170B33B000462214 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 880EED45170B33B000462214 /* Default.png */; }; - 880EED48170B33B000462214 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 880EED47170B33B000462214 /* Default@2x.png */; }; - 880EED4A170B33B000462214 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 880EED49170B33B000462214 /* Default-568h@2x.png */; }; - 880EED4D170B33B000462214 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 880EED4B170B33B000462214 /* MainStoryboard.storyboard */; }; - 880EED53170B33B000462214 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EED52170B33B000462214 /* ViewController.m */; }; - 880EED9E170B357400462214 /* BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EED9A170B357400462214 /* BButton.m */; }; - 880EED9F170B357400462214 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 880EED9C170B357400462214 /* FontAwesome.ttf */; }; - 880EEDA2170B3EDB00462214 /* UIColor+BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EEDA1170B3EDB00462214 /* UIColor+BButton.m */; }; - 880EEDA5170B6D2600462214 /* NSString+FontAwesome.m in Sources */ = {isa = PBXBuildFile; fileRef = 880EEDA4170B6D2600462214 /* NSString+FontAwesome.m */; }; - 8857FBFD1718B92B001C200D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8857FBFC1718B92B001C200D /* CoreGraphics.framework */; }; + 88F28F1B183336920044C99F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F1A183336920044C99F /* Foundation.framework */; }; + 88F28F1D183336920044C99F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F1C183336920044C99F /* CoreGraphics.framework */; }; + 88F28F1F183336920044C99F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F1E183336920044C99F /* UIKit.framework */; }; + 88F28F25183336920044C99F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F23183336920044C99F /* InfoPlist.strings */; }; + 88F28F27183336920044C99F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F26183336920044C99F /* main.m */; }; + 88F28F2B183336920044C99F /* TWBSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F2A183336920044C99F /* TWBSAppDelegate.m */; }; + 88F28F2E183336920044C99F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F2C183336920044C99F /* Main.storyboard */; }; + 88F28F31183336920044C99F /* TWBSDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F30183336920044C99F /* TWBSDemoViewController.m */; }; + 88F28F33183336920044C99F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F32183336920044C99F /* Images.xcassets */; }; + 88F28F3A183336920044C99F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F39183336920044C99F /* XCTest.framework */; }; + 88F28F3B183336920044C99F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F1A183336920044C99F /* Foundation.framework */; }; + 88F28F3C183336920044C99F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F28F1E183336920044C99F /* UIKit.framework */; }; + 88F28F44183336920044C99F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F42183336920044C99F /* InfoPlist.strings */; }; + 88F28F46183336920044C99F /* BButtonDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F45183336920044C99F /* BButtonDemoTests.m */; }; + 88F28F5B183337F40044C99F /* BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F52183337F40044C99F /* BButton.m */; }; + 88F28F5C183337F40044C99F /* BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F52183337F40044C99F /* BButton.m */; }; + 88F28F5F183337F40044C99F /* NSString+FontAwesome.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F56183337F40044C99F /* NSString+FontAwesome.m */; }; + 88F28F60183337F40044C99F /* NSString+FontAwesome.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F56183337F40044C99F /* NSString+FontAwesome.m */; }; + 88F28F61183337F40044C99F /* UIColor+BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F58183337F40044C99F /* UIColor+BButton.m */; }; + 88F28F62183337F40044C99F /* UIColor+BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F28F58183337F40044C99F /* UIColor+BButton.m */; }; + 88F28F63183337F40044C99F /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F5A183337F40044C99F /* FontAwesome.ttf */; }; + 88F28F64183337F40044C99F /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 88F28F5A183337F40044C99F /* FontAwesome.ttf */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 88F28F3D183336920044C99F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 88F28F0F183336920044C99F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 88F28F16183336920044C99F; + remoteInfo = BButtonDemo; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ - 880EED30170B33B000462214 /* BButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 880EED33170B33B000462214 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 880EED35170B33B000462214 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 880EED3B170B33B000462214 /* BButtonDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BButtonDemo-Info.plist"; sourceTree = ""; }; - 880EED3D170B33B000462214 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 880EED3F170B33B000462214 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 880EED41170B33B000462214 /* BButtonDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BButtonDemo-Prefix.pch"; sourceTree = ""; }; - 880EED42170B33B000462214 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 880EED43170B33B000462214 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 880EED45170B33B000462214 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - 880EED47170B33B000462214 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; - 880EED49170B33B000462214 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 880EED4C170B33B000462214 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; - 880EED51170B33B000462214 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 880EED52170B33B000462214 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 880EED99170B357400462214 /* BButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BButton.h; sourceTree = ""; }; - 880EED9A170B357400462214 /* BButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BButton.m; sourceTree = ""; }; - 880EED9C170B357400462214 /* FontAwesome.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome.ttf; sourceTree = ""; }; - 880EEDA0170B3EDB00462214 /* UIColor+BButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+BButton.h"; sourceTree = ""; }; - 880EEDA1170B3EDB00462214 /* UIColor+BButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+BButton.m"; sourceTree = ""; }; - 880EEDA3170B6D2600462214 /* NSString+FontAwesome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FontAwesome.h"; sourceTree = ""; }; - 880EEDA4170B6D2600462214 /* NSString+FontAwesome.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FontAwesome.m"; sourceTree = ""; }; - 8857FBFC1718B92B001C200D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 88F28F17183336920044C99F /* BButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 88F28F1A183336920044C99F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 88F28F1C183336920044C99F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 88F28F1E183336920044C99F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 88F28F22183336920044C99F /* BButtonDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BButtonDemo-Info.plist"; sourceTree = ""; }; + 88F28F24183336920044C99F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 88F28F26183336920044C99F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 88F28F28183336920044C99F /* BButtonDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BButtonDemo-Prefix.pch"; sourceTree = ""; }; + 88F28F29183336920044C99F /* TWBSAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TWBSAppDelegate.h; sourceTree = ""; }; + 88F28F2A183336920044C99F /* TWBSAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TWBSAppDelegate.m; sourceTree = ""; }; + 88F28F2D183336920044C99F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 88F28F2F183336920044C99F /* TWBSDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TWBSDemoViewController.h; sourceTree = ""; }; + 88F28F30183336920044C99F /* TWBSDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TWBSDemoViewController.m; sourceTree = ""; }; + 88F28F32183336920044C99F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 88F28F38183336920044C99F /* BButtonDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BButtonDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 88F28F39183336920044C99F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 88F28F41183336920044C99F /* BButtonDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BButtonDemoTests-Info.plist"; sourceTree = ""; }; + 88F28F43183336920044C99F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 88F28F45183336920044C99F /* BButtonDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BButtonDemoTests.m; sourceTree = ""; }; + 88F28F51183337F40044C99F /* BButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BButton.h; sourceTree = ""; }; + 88F28F52183337F40044C99F /* BButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BButton.m; sourceTree = ""; }; + 88F28F55183337F40044C99F /* NSString+FontAwesome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FontAwesome.h"; sourceTree = ""; }; + 88F28F56183337F40044C99F /* NSString+FontAwesome.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FontAwesome.m"; sourceTree = ""; }; + 88F28F57183337F40044C99F /* UIColor+BButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+BButton.h"; sourceTree = ""; }; + 88F28F58183337F40044C99F /* UIColor+BButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+BButton.m"; sourceTree = ""; }; + 88F28F5A183337F40044C99F /* FontAwesome.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome.ttf; sourceTree = ""; }; + 88F28F65183338210044C99F /* BButton.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = BButton.podspec; sourceTree = ""; }; + 88F28F68183338210044C99F /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.md; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 880EED2D170B33B000462214 /* Frameworks */ = { + 88F28F14183336920044C99F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8857FBFD1718B92B001C200D /* CoreGraphics.framework in Frameworks */, - 880EED34170B33B000462214 /* UIKit.framework in Frameworks */, - 880EED36170B33B000462214 /* Foundation.framework in Frameworks */, + 88F28F1D183336920044C99F /* CoreGraphics.framework in Frameworks */, + 88F28F1F183336920044C99F /* UIKit.framework in Frameworks */, + 88F28F1B183336920044C99F /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 88F28F35183336920044C99F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 88F28F3A183336920044C99F /* XCTest.framework in Frameworks */, + 88F28F3C183336920044C99F /* UIKit.framework in Frameworks */, + 88F28F3B183336920044C99F /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 880EED27170B33B000462214 = { + 88F28F0E183336920044C99F = { isa = PBXGroup; children = ( - 880EED96170B357400462214 /* BButton */, - 880EED39170B33B000462214 /* BButtonDemo */, - 880EED32170B33B000462214 /* Frameworks */, - 880EED31170B33B000462214 /* Products */, + 88F28F4F183337F40044C99F /* BButton */, + 88F28F65183338210044C99F /* BButton.podspec */, + 88F28F68183338210044C99F /* README.md */, + 88F28F20183336920044C99F /* BButtonDemo */, + 88F28F3F183336920044C99F /* BButtonDemoTests */, + 88F28F19183336920044C99F /* Frameworks */, + 88F28F18183336920044C99F /* Products */, ); sourceTree = ""; }; - 880EED31170B33B000462214 /* Products */ = { + 88F28F18183336920044C99F /* Products */ = { isa = PBXGroup; children = ( - 880EED30170B33B000462214 /* BButtonDemo.app */, + 88F28F17183336920044C99F /* BButtonDemo.app */, + 88F28F38183336920044C99F /* BButtonDemoTests.xctest */, ); name = Products; sourceTree = ""; }; - 880EED32170B33B000462214 /* Frameworks */ = { + 88F28F19183336920044C99F /* Frameworks */ = { isa = PBXGroup; children = ( - 8857FBFC1718B92B001C200D /* CoreGraphics.framework */, - 880EED33170B33B000462214 /* UIKit.framework */, - 880EED35170B33B000462214 /* Foundation.framework */, + 88F28F1A183336920044C99F /* Foundation.framework */, + 88F28F1C183336920044C99F /* CoreGraphics.framework */, + 88F28F1E183336920044C99F /* UIKit.framework */, + 88F28F39183336920044C99F /* XCTest.framework */, ); name = Frameworks; sourceTree = ""; }; - 880EED39170B33B000462214 /* BButtonDemo */ = { + 88F28F20183336920044C99F /* BButtonDemo */ = { isa = PBXGroup; children = ( - 880EED42170B33B000462214 /* AppDelegate.h */, - 880EED43170B33B000462214 /* AppDelegate.m */, - 880EED4B170B33B000462214 /* MainStoryboard.storyboard */, - 880EED51170B33B000462214 /* ViewController.h */, - 880EED52170B33B000462214 /* ViewController.m */, - 880EED3A170B33B000462214 /* Supporting Files */, + 88F28F29183336920044C99F /* TWBSAppDelegate.h */, + 88F28F2A183336920044C99F /* TWBSAppDelegate.m */, + 88F28F2C183336920044C99F /* Main.storyboard */, + 88F28F2F183336920044C99F /* TWBSDemoViewController.h */, + 88F28F30183336920044C99F /* TWBSDemoViewController.m */, + 88F28F32183336920044C99F /* Images.xcassets */, + 88F28F21183336920044C99F /* Supporting Files */, ); path = BButtonDemo; sourceTree = ""; }; - 880EED3A170B33B000462214 /* Supporting Files */ = { + 88F28F21183336920044C99F /* Supporting Files */ = { isa = PBXGroup; children = ( - 880EED3B170B33B000462214 /* BButtonDemo-Info.plist */, - 880EED3C170B33B000462214 /* InfoPlist.strings */, - 880EED3F170B33B000462214 /* main.m */, - 880EED41170B33B000462214 /* BButtonDemo-Prefix.pch */, - 880EED45170B33B000462214 /* Default.png */, - 880EED47170B33B000462214 /* Default@2x.png */, - 880EED49170B33B000462214 /* Default-568h@2x.png */, + 88F28F22183336920044C99F /* BButtonDemo-Info.plist */, + 88F28F23183336920044C99F /* InfoPlist.strings */, + 88F28F26183336920044C99F /* main.m */, + 88F28F28183336920044C99F /* BButtonDemo-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; - 880EED96170B357400462214 /* BButton */ = { + 88F28F3F183336920044C99F /* BButtonDemoTests */ = { isa = PBXGroup; children = ( - 880EED99170B357400462214 /* BButton.h */, - 880EED9A170B357400462214 /* BButton.m */, - 880EEDA3170B6D2600462214 /* NSString+FontAwesome.h */, - 880EEDA4170B6D2600462214 /* NSString+FontAwesome.m */, - 880EEDA0170B3EDB00462214 /* UIColor+BButton.h */, - 880EEDA1170B3EDB00462214 /* UIColor+BButton.m */, - 880EED9B170B357400462214 /* resources */, + 88F28F45183336920044C99F /* BButtonDemoTests.m */, + 88F28F40183336920044C99F /* Supporting Files */, + ); + path = BButtonDemoTests; + sourceTree = ""; + }; + 88F28F40183336920044C99F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 88F28F41183336920044C99F /* BButtonDemoTests-Info.plist */, + 88F28F42183336920044C99F /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 88F28F4F183337F40044C99F /* BButton */ = { + isa = PBXGroup; + children = ( + 88F28F50183337F40044C99F /* Classes */, + 88F28F59183337F40044C99F /* Resources */, ); path = BButton; sourceTree = ""; }; - 880EED9B170B357400462214 /* resources */ = { + 88F28F50183337F40044C99F /* Classes */ = { isa = PBXGroup; children = ( - 880EED9C170B357400462214 /* FontAwesome.ttf */, + 88F28F51183337F40044C99F /* BButton.h */, + 88F28F52183337F40044C99F /* BButton.m */, + 88F28F55183337F40044C99F /* NSString+FontAwesome.h */, + 88F28F56183337F40044C99F /* NSString+FontAwesome.m */, + 88F28F57183337F40044C99F /* UIColor+BButton.h */, + 88F28F58183337F40044C99F /* UIColor+BButton.m */, ); - path = resources; + path = Classes; + sourceTree = ""; + }; + 88F28F59183337F40044C99F /* Resources */ = { + isa = PBXGroup; + children = ( + 88F28F5A183337F40044C99F /* FontAwesome.ttf */, + ); + path = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 880EED2F170B33B000462214 /* BButtonDemo */ = { + 88F28F16183336920044C99F /* BButtonDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = 880EED56170B33B000462214 /* Build configuration list for PBXNativeTarget "BButtonDemo" */; + buildConfigurationList = 88F28F49183336920044C99F /* Build configuration list for PBXNativeTarget "BButtonDemo" */; buildPhases = ( - 880EED2C170B33B000462214 /* Sources */, - 880EED2D170B33B000462214 /* Frameworks */, - 880EED2E170B33B000462214 /* Resources */, + 88F28F13183336920044C99F /* Sources */, + 88F28F14183336920044C99F /* Frameworks */, + 88F28F15183336920044C99F /* Resources */, ); buildRules = ( ); @@ -158,101 +219,164 @@ ); name = BButtonDemo; productName = BButtonDemo; - productReference = 880EED30170B33B000462214 /* BButtonDemo.app */; + productReference = 88F28F17183336920044C99F /* BButtonDemo.app */; productType = "com.apple.product-type.application"; }; + 88F28F37183336920044C99F /* BButtonDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 88F28F4C183336920044C99F /* Build configuration list for PBXNativeTarget "BButtonDemoTests" */; + buildPhases = ( + 88F28F34183336920044C99F /* Sources */, + 88F28F35183336920044C99F /* Frameworks */, + 88F28F36183336920044C99F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 88F28F3E183336920044C99F /* PBXTargetDependency */, + ); + name = BButtonDemoTests; + productName = BButtonDemoTests; + productReference = 88F28F38183336920044C99F /* BButtonDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 880EED28170B33B000462214 /* Project object */ = { + 88F28F0F183336920044C99F /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + CLASSPREFIX = TWBS; + LastUpgradeCheck = 0510; ORGANIZATIONNAME = "Hexed Bits"; + TargetAttributes = { + 88F28F37183336920044C99F = { + TestTargetID = 88F28F16183336920044C99F; + }; + }; }; - buildConfigurationList = 880EED2B170B33B000462214 /* Build configuration list for PBXProject "BButtonDemo" */; + buildConfigurationList = 88F28F12183336920044C99F /* Build configuration list for PBXProject "BButtonDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); - mainGroup = 880EED27170B33B000462214; - productRefGroup = 880EED31170B33B000462214 /* Products */; + mainGroup = 88F28F0E183336920044C99F; + productRefGroup = 88F28F18183336920044C99F /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 880EED2F170B33B000462214 /* BButtonDemo */, + 88F28F16183336920044C99F /* BButtonDemo */, + 88F28F37183336920044C99F /* BButtonDemoTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 880EED2E170B33B000462214 /* Resources */ = { + 88F28F15183336920044C99F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 88F28F33183336920044C99F /* Images.xcassets in Resources */, + 88F28F25183336920044C99F /* InfoPlist.strings in Resources */, + 88F28F2E183336920044C99F /* Main.storyboard in Resources */, + 88F28F63183337F40044C99F /* FontAwesome.ttf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 88F28F36183336920044C99F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 880EED3E170B33B000462214 /* InfoPlist.strings in Resources */, - 880EED46170B33B000462214 /* Default.png in Resources */, - 880EED48170B33B000462214 /* Default@2x.png in Resources */, - 880EED4A170B33B000462214 /* Default-568h@2x.png in Resources */, - 880EED4D170B33B000462214 /* MainStoryboard.storyboard in Resources */, - 880EED9F170B357400462214 /* FontAwesome.ttf in Resources */, + 88F28F44183336920044C99F /* InfoPlist.strings in Resources */, + 88F28F64183337F40044C99F /* FontAwesome.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 880EED2C170B33B000462214 /* Sources */ = { + 88F28F13183336920044C99F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 88F28F2B183336920044C99F /* TWBSAppDelegate.m in Sources */, + 88F28F27183336920044C99F /* main.m in Sources */, + 88F28F61183337F40044C99F /* UIColor+BButton.m in Sources */, + 88F28F5F183337F40044C99F /* NSString+FontAwesome.m in Sources */, + 88F28F5B183337F40044C99F /* BButton.m in Sources */, + 88F28F31183336920044C99F /* TWBSDemoViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 88F28F34183336920044C99F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 880EED40170B33B000462214 /* main.m in Sources */, - 880EED44170B33B000462214 /* AppDelegate.m in Sources */, - 880EED53170B33B000462214 /* ViewController.m in Sources */, - 880EED9E170B357400462214 /* BButton.m in Sources */, - 880EEDA2170B3EDB00462214 /* UIColor+BButton.m in Sources */, - 880EEDA5170B6D2600462214 /* NSString+FontAwesome.m in Sources */, + 88F28F60183337F40044C99F /* NSString+FontAwesome.m in Sources */, + 88F28F5C183337F40044C99F /* BButton.m in Sources */, + 88F28F62183337F40044C99F /* UIColor+BButton.m in Sources */, + 88F28F46183336920044C99F /* BButtonDemoTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 88F28F3E183336920044C99F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 88F28F16183336920044C99F /* BButtonDemo */; + targetProxy = 88F28F3D183336920044C99F /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ - 880EED3C170B33B000462214 /* InfoPlist.strings */ = { + 88F28F23183336920044C99F /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 880EED3D170B33B000462214 /* en */, + 88F28F24183336920044C99F /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; - 880EED4B170B33B000462214 /* MainStoryboard.storyboard */ = { + 88F28F2C183336920044C99F /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 880EED4C170B33B000462214 /* en */, + 88F28F2D183336920044C99F /* Base */, ); - name = MainStoryboard.storyboard; + name = Main.storyboard; + sourceTree = ""; + }; + 88F28F42183336920044C99F /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 88F28F43183336920044C99F /* en */, + ); + name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 880EED54170B33B000462214 /* Debug */ = { + 88F28F47183336920044C99F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -262,107 +386,162 @@ "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; - PROVISIONING_PROFILE = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - 880EED55170B33B000462214 /* Release */ = { + 88F28F48183336920044C99F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - PROVISIONING_PROFILE = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; - 880EED57170B33B000462214 /* Debug */ = { + 88F28F4A183336920044C99F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_OBJC_RECEIVER_WEAK = YES; - CODE_SIGN_IDENTITY = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "BButtonDemo/BButtonDemo-Prefix.pch"; INFOPLIST_FILE = "BButtonDemo/BButtonDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = NO; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; + PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; }; name = Debug; }; - 880EED58170B33B000462214 /* Release */ = { + 88F28F4B183336920044C99F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_OBJC_RECEIVER_WEAK = YES; - CODE_SIGN_IDENTITY = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jesse Squires (64KYPKJ7RK)"; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "BButtonDemo/BButtonDemo-Prefix.pch"; INFOPLIST_FILE = "BButtonDemo/BButtonDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = NO; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = "0D0EEA35-157A-4FFD-A4A2-5F4A52C12634"; + PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; }; name = Release; }; + 88F28F4D183336920044C99F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BButtonDemo.app/BButtonDemo"; + CODE_SIGN_IDENTITY = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BButtonDemo/BButtonDemo-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "BButtonDemoTests/BButtonDemoTests-Info.plist"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "33D9D386-8DC3-4040-BF92-DA1C5D32964B"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 88F28F4E183336920044C99F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BButtonDemo.app/BButtonDemo"; + CODE_SIGN_IDENTITY = ""; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BButtonDemo/BButtonDemo-Prefix.pch"; + INFOPLIST_FILE = "BButtonDemoTests/BButtonDemoTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "33D9D386-8DC3-4040-BF92-DA1C5D32964B"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 880EED2B170B33B000462214 /* Build configuration list for PBXProject "BButtonDemo" */ = { + 88F28F12183336920044C99F /* Build configuration list for PBXProject "BButtonDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 88F28F47183336920044C99F /* Debug */, + 88F28F48183336920044C99F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 88F28F49183336920044C99F /* Build configuration list for PBXNativeTarget "BButtonDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( - 880EED54170B33B000462214 /* Debug */, - 880EED55170B33B000462214 /* Release */, + 88F28F4A183336920044C99F /* Debug */, + 88F28F4B183336920044C99F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 880EED56170B33B000462214 /* Build configuration list for PBXNativeTarget "BButtonDemo" */ = { + 88F28F4C183336920044C99F /* Build configuration list for PBXNativeTarget "BButtonDemoTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 880EED57170B33B000462214 /* Debug */, - 880EED58170B33B000462214 /* Release */, + 88F28F4D183336920044C99F /* Debug */, + 88F28F4E183336920044C99F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 880EED28170B33B000462214 /* Project object */; + rootObject = 88F28F0F183336920044C99F /* Project object */; } diff --git a/BButtonDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/BButtonDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..08de0be --- /dev/null +++ b/BButtonDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/BButtonDemo.xcodeproj/xcshareddata/xcschemes/BButtonDemo.xcscheme b/BButtonDemo.xcodeproj/xcshareddata/xcschemes/BButtonDemo.xcscheme new file mode 100644 index 0000000..75e3c9a --- /dev/null +++ b/BButtonDemo.xcodeproj/xcshareddata/xcschemes/BButtonDemo.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BButtonDemo/AppDelegate.m b/BButtonDemo/AppDelegate.m deleted file mode 100644 index d96d01e..0000000 --- a/BButtonDemo/AppDelegate.m +++ /dev/null @@ -1,26 +0,0 @@ -// -// AppDelegate.m -// BButtonDemo -// -// Created by Jesse Squires on 4/2/13. -// Copyright (c) 2013 Hexed Bits. All rights reserved. -// -// http://hexedbits.com -// - -#import "AppDelegate.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { } -- (void)applicationDidEnterBackground:(UIApplication *)application { } -- (void)applicationWillEnterForeground:(UIApplication *)application { } -- (void)applicationDidBecomeActive:(UIApplication *)application { } -- (void)applicationWillTerminate:(UIApplication *)application { } - -@end \ No newline at end of file diff --git a/BButtonDemo/BButtonDemo-Info.plist b/BButtonDemo/BButtonDemo-Info.plist index 65916c5..c560ce0 100644 --- a/BButtonDemo/BButtonDemo-Info.plist +++ b/BButtonDemo/BButtonDemo-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0 + 4.0.2 CFBundleSignature ???? CFBundleVersion - 2.0 + 4.0.2 LSRequiresIPhoneOS UIAppFonts @@ -29,9 +29,7 @@ FontAwesome.ttf UIMainStoryboardFile - MainStoryboard - UIMainStoryboardFile~ipad - MainStoryboard + Main UIRequiredDeviceCapabilities armv7 @@ -40,9 +38,5 @@ UIInterfaceOrientationPortrait - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - diff --git a/BButtonDemo/BButtonDemo-Prefix.pch b/BButtonDemo/BButtonDemo-Prefix.pch index 1369a89..82a2bb4 100644 --- a/BButtonDemo/BButtonDemo-Prefix.pch +++ b/BButtonDemo/BButtonDemo-Prefix.pch @@ -1,5 +1,7 @@ // -// Prefix header for all source files of the 'BButtonDemo' target in the 'BButtonDemo' project +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. // #import diff --git a/BButtonDemo/en.lproj/MainStoryboard.storyboard b/BButtonDemo/Base.lproj/Main.storyboard similarity index 54% rename from BButtonDemo/en.lproj/MainStoryboard.storyboard rename to BButtonDemo/Base.lproj/Main.storyboard index ca57a67..378237c 100644 --- a/BButtonDemo/en.lproj/MainStoryboard.storyboard +++ b/BButtonDemo/Base.lproj/Main.storyboard @@ -1,28 +1,28 @@ - + - + + - - + + - - - + + + + + + + - + - - - - - diff --git a/BButtonDemo/Default-568h@2x.png b/BButtonDemo/Default-568h@2x.png deleted file mode 100644 index 0891b7a..0000000 Binary files a/BButtonDemo/Default-568h@2x.png and /dev/null differ diff --git a/BButtonDemo/Default.png b/BButtonDemo/Default.png deleted file mode 100644 index 4c8ca6f..0000000 Binary files a/BButtonDemo/Default.png and /dev/null differ diff --git a/BButtonDemo/Default@2x.png b/BButtonDemo/Default@2x.png deleted file mode 100644 index 35b84cf..0000000 Binary files a/BButtonDemo/Default@2x.png and /dev/null differ diff --git a/BButtonDemo/Images.xcassets/AppIcon.appiconset/Contents.json b/BButtonDemo/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a396706 --- /dev/null +++ b/BButtonDemo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BButtonDemo/Images.xcassets/LaunchImage.launchimage/Contents.json b/BButtonDemo/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000..c79ebd3 --- /dev/null +++ b/BButtonDemo/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BButtonDemo/AppDelegate.h b/BButtonDemo/TWBSAppDelegate.h similarity index 52% rename from BButtonDemo/AppDelegate.h rename to BButtonDemo/TWBSAppDelegate.h index 4df86cb..367357e 100644 --- a/BButtonDemo/AppDelegate.h +++ b/BButtonDemo/TWBSAppDelegate.h @@ -1,16 +1,13 @@ // -// AppDelegate.h // BButtonDemo // -// Created by Jesse Squires on 4/2/13. +// Created by Jesse Squires on 11/12/13. // Copyright (c) 2013 Hexed Bits. All rights reserved. // -// http://hexedbits.com -// #import -@interface AppDelegate : UIResponder +@interface TWBSAppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; diff --git a/BButtonDemo/TWBSAppDelegate.m b/BButtonDemo/TWBSAppDelegate.m new file mode 100644 index 0000000..f2931c0 --- /dev/null +++ b/BButtonDemo/TWBSAppDelegate.m @@ -0,0 +1,17 @@ +// +// BButtonDemo +// +// Created by Jesse Squires on 11/12/13. +// Copyright (c) 2013 Hexed Bits. All rights reserved. +// + +#import "TWBSAppDelegate.h" + +@implementation TWBSAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + return YES; +} + +@end diff --git a/BButtonDemo/TWBSDemoViewController.h b/BButtonDemo/TWBSDemoViewController.h new file mode 100644 index 0000000..e296fcf --- /dev/null +++ b/BButtonDemo/TWBSDemoViewController.h @@ -0,0 +1,13 @@ +// +// BButtonDemo +// +// Created by Jesse Squires on 11/12/13. +// Copyright (c) 2013 Hexed Bits. All rights reserved. +// + +#import +#import "BButton.h" + +@interface TWBSDemoViewController : UIViewController + +@end diff --git a/BButtonDemo/TWBSDemoViewController.m b/BButtonDemo/TWBSDemoViewController.m new file mode 100644 index 0000000..f1204dd --- /dev/null +++ b/BButtonDemo/TWBSDemoViewController.m @@ -0,0 +1,103 @@ +// +// BButtonDemo +// +// Created by Jesse Squires on 11/12/13. +// Copyright (c) 2013 Hexed Bits. All rights reserved. +// + +#import "TWBSDemoViewController.h" + +@implementation TWBSDemoViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // uncomment to set corner radius for all buttons + // + // [[BButton appearance] setButtonCornerRadius:@50.0f]; + + BButtonType type = 0; + + for(int i = 0; i < 2; i++) { + + for(int j = 0; j < 7; j++) { + CGRect frame = CGRectMake(32.0f + (i * 144.0f), + 40.0f + (j * 60.0f), + 112.0f, + 44.0f); + + BButton *btn = [[BButton alloc] initWithFrame:frame type:type style:BButtonStyleBootstrapV3]; + [btn setTitle:[self titleForType:type] forState:UIControlStateNormal]; + + if(type == BButtonTypeFacebook) + [btn addAwesomeIcon:FAFacebook beforeTitle:YES]; + else if(type == BButtonTypeTwitter) + [btn addAwesomeIcon:FATwitter beforeTitle:NO]; + + type++; + if(type > BButtonTypeGray) { + btn = [BButton awesomeButtonWithOnlyIcon:(arc4random_uniform(0xf20c-0xf000)+0xf000) + type:(type % 2) ? BButtonTypeInverse : BButtonTypeDefault + style:BButtonStyleBootstrapV3]; + + btn.frame = CGRectMake(frame.origin.x, frame.origin.y, btn.frame.size.width, btn.frame.size.width); + } + + [btn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; + + // uncomment to show buttons as disabled + // + // btn.shouldShowDisabled = YES; + // btn.enabled = NO; + + [self.view addSubview:btn]; + } + } +} + +- (void)buttonPressed:(UIButton *)sender +{ + NSLog(@"Good jorb, you pressed a button: %@", sender.titleLabel.text); +} + +- (NSString *)titleForType:(BButtonType)type +{ + switch (type) { + case BButtonTypePrimary: + return @"Primary"; + + case BButtonTypeInfo: + return @"Info"; + + case BButtonTypeSuccess: + return @"Success"; + + case BButtonTypeWarning: + return @"Warning"; + + case BButtonTypeDanger: + return @"Danger"; + + case BButtonTypeInverse: + return @"Inverse"; + + case BButtonTypeTwitter: + return @"Twitter"; + + case BButtonTypeFacebook: + return @"Facebook"; + + case BButtonTypePurple: + return @"Purple"; + + case BButtonTypeGray: + return @"Gray"; + + case BButtonTypeDefault: + default: + return @"Default"; + } +} + +@end diff --git a/BButtonDemo/ViewController.h b/BButtonDemo/ViewController.h deleted file mode 100644 index f19facc..0000000 --- a/BButtonDemo/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ViewController.h -// BButtonDemo -// -// Created by Jesse Squires on 4/2/13. -// Copyright (c) 2013 Hexed Bits. All rights reserved. -// -// http://hexedbits.com -// - -#import -#import "BButton.h" - -@interface ViewController : UIViewController - -@end \ No newline at end of file diff --git a/BButtonDemo/ViewController.m b/BButtonDemo/ViewController.m deleted file mode 100644 index 6c17a41..0000000 --- a/BButtonDemo/ViewController.m +++ /dev/null @@ -1,100 +0,0 @@ -// -// ViewController.m -// BButtonDemo -// -// Created by Jesse Squires on 4/2/13. -// Copyright (c) 2013 Hexed Bits. All rights reserved. -// -// http://hexedbits.com -// - -#import "ViewController.h" - -@interface ViewController () - -- (NSString *)titleForType:(BButtonType)type; - -@end - - - -@implementation ViewController - -#pragma mark - View lifecycle -- (void)viewDidLoad -{ - [super viewDidLoad]; - - BButtonType type = 0; - - for(int i = 0; i < 2; i++) { - - for(int j = 0; j < 7; j++) { - CGRect frame = CGRectMake(32.0f + (i * 144.0f), 20.0f + (j * 60.0f), 112.0f, 40.0f); - BButton *btn = [[BButton alloc] initWithFrame:frame type:type]; - [btn setTitle:[self titleForType:type] forState:UIControlStateNormal]; - - if(type == BButtonTypeFacebook) - [btn addAwesomeIcon:FAIconFacebook beforeTitle:YES]; - else if(type == BButtonTypeTwitter) - [btn addAwesomeIcon:FAIconTwitter beforeTitle:NO]; - - type++; - if(type > BButtonTypeGray) { - btn = [BButton awesomeButtonWithOnlyIcon:arc4random() % 209 - type:(type % 2) ? BButtonTypeInverse : BButtonTypeDefault]; - - btn.frame = CGRectMake(frame.origin.x, frame.origin.y, btn.frame.size.width, btn.frame.size.width); - } - - [self.view addSubview:btn]; - } - } -} - -#pragma mark - Utilities -- (NSString *)titleForType:(BButtonType)type -{ - NSString *title = nil; - - switch (type) { - case BButtonTypePrimary: - title = @"Primary"; - break; - case BButtonTypeInfo: - title = @"Info"; - break; - case BButtonTypeSuccess: - title = @"Success"; - break; - case BButtonTypeWarning: - title = @"Warning"; - break; - case BButtonTypeDanger: - title = @"Danger"; - break; - case BButtonTypeInverse: - title = @"Inverse"; - break; - case BButtonTypeTwitter: - title = @"Twitter"; - break; - case BButtonTypeFacebook: - title = @"Facebook"; - break; - case BButtonTypePurple: - title = @"Purple"; - break; - case BButtonTypeGray: - title = @"Gray"; - break; - case BButtonTypeDefault: - default: - title = @"Default"; - break; - } - - return title; -} - -@end \ No newline at end of file diff --git a/BButtonDemo/main.m b/BButtonDemo/main.m index 87233f1..6d94839 100644 --- a/BButtonDemo/main.m +++ b/BButtonDemo/main.m @@ -2,17 +2,17 @@ // main.m // BButtonDemo // -// Created by Jesse Squires on 4/2/13. +// Created by Jesse Squires on 11/12/13. // Copyright (c) 2013 Hexed Bits. All rights reserved. // #import -#import "AppDelegate.h" +#import "TWBSAppDelegate.h" -int main(int argc, char *argv[]) +int main(int argc, char * argv[]) { @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([TWBSAppDelegate class])); } } diff --git a/BButtonDemoTests/BButtonDemoTests-Info.plist b/BButtonDemoTests/BButtonDemoTests-Info.plist new file mode 100644 index 0000000..75431a4 --- /dev/null +++ b/BButtonDemoTests/BButtonDemoTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.hexedbits.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/BButtonDemoTests/BButtonDemoTests.m b/BButtonDemoTests/BButtonDemoTests.m new file mode 100644 index 0000000..ba99904 --- /dev/null +++ b/BButtonDemoTests/BButtonDemoTests.m @@ -0,0 +1,117 @@ +// +// Created by Mathieu Bolard on 31/07/12. +// Copyright (c) 2012 Mathieu Bolard. All rights reserved. +// +// https://github.com/mattlawer/BButton +// +// +// BButton is licensed under the MIT license +// http://opensource.org/licenses/MIT +// +// +// ----------------------------------------- +// Edited and refactored by Jesse Squires on 2 April, 2013. +// +// http://github.com/jessesquires/BButton +// +// http://hexedbits.com +// + +#import +#import "BButton.h" + +@interface BButtonDemoTests : XCTestCase + +@end + + +@implementation BButtonDemoTests + +- (void)testButtonInitMethods +{ + CGRect frame = CGRectMake(0.0f, 0.0f, 140.0f, 44.0f); + + BButton *btn = [[BButton alloc] initWithFrame:frame type:BButtonTypeDefault style:BButtonStyleBootstrapV2]; + XCTAssertNotNil(btn, @"Button should not be nil"); + XCTAssert([btn.color isEqual:[UIColor bb_defaultColorV2]], @"Colors should be equal"); + + btn = nil; + btn = [[BButton alloc] initWithFrame:frame + type:BButtonTypeWarning + style:BButtonStyleBootstrapV3 + icon:FAAdjust + fontSize:14.0f]; + XCTAssertNotNil(btn, @"Button should not be nil"); + XCTAssert([btn.color isEqual:[UIColor bb_warningColorV3]], @"Colors should be equal"); + + + + btn = nil; + btn = [[BButton alloc] initWithFrame:frame color:[UIColor redColor] style:BButtonStyleBootstrapV3]; + XCTAssertNotNil(btn, @"Button should not be nil"); + + + + btn = nil; + btn = [[BButton alloc] initWithFrame:frame + color:[UIColor blackColor] + style:BButtonStyleBootstrapV3 + icon:FASearchMinus + fontSize:16.0f]; + XCTAssertNotNil(btn, @"Button should not be nil"); + + + + btn = nil; + btn = [BButton awesomeButtonWithOnlyIcon:FASearchPlus color:[UIColor blueColor] style:BButtonStyleBootstrapV2]; + XCTAssertNotNil(btn, @"Button should not be nil"); + XCTAssert([btn.titleLabel.text length] == 1, @"Button text should only include FAIcon"); +} + +- (void)testButtonClassInitMethods +{ + BButton *btn = [BButton awesomeButtonWithOnlyIcon:FAUserMd type:BButtonTypeSuccess style:BButtonStyleBootstrapV3]; + XCTAssert([btn.color isEqual:[UIColor bb_successColorV3]], @"Colors should be equal"); + XCTAssertNotNil(btn, @"Button should not be nil"); + XCTAssert([btn.titleLabel.text length] == 1, @"Button text should only include FAIcon"); + + + + btn = nil; + btn = [BButton awesomeButtonWithOnlyIcon:FASearchPlus color:[UIColor blueColor] style:BButtonStyleBootstrapV2]; + XCTAssertNotNil(btn, @"Button should not be nil"); + XCTAssert([btn.titleLabel.text length] == 1, @"Button text should only include FAIcon"); +} + +- (void)testFontAwesome +{ + NSString *icon = [NSString fa_stringForFontAwesomeIcon:FAWarning]; + XCTAssertNotNil(icon, @"Icon should not be nil"); + + NSString *btnTitle = @"Button Title"; + FAIcon i = FAVolumeDown; + BButton *btn = [[BButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, 50.0f) + type:BButtonTypeInverse + style:BButtonStyleBootstrapV2]; + XCTAssert([btn.color isEqual:[UIColor bb_inverseColorV2]], @"Colors should be equal"); + + [btn setTitle:btnTitle forState:UIControlStateNormal]; + XCTAssertEqual([btn.titleLabel.text length], [btnTitle length], @"Button title lengths should be equal"); + + [btn addAwesomeIcon:i beforeTitle:NO]; + XCTAssertEqual([btn.titleLabel.text length], [btnTitle length] + 2, @"Button title length should be 2 characters longer after adding icon"); + + icon = [NSString fa_stringForFontAwesomeIcon:i]; + NSString *btnIcon = [btn.titleLabel.text substringFromIndex:[btn.titleLabel.text length] - 1]; + XCTAssert([btnIcon isEqualToString:icon], @"Last character in button title should equal FA icon"); + + i = FATerminal; + [btn addAwesomeIcon:i beforeTitle:YES]; + XCTAssertEqual([btn.titleLabel.text length], [btnTitle length] + 4, @"Button title length should be 4 characters longer after adding 2 icons"); + + icon = [NSString fa_stringForFontAwesomeIcon:i]; + btnIcon = [btn.titleLabel.text substringToIndex:1]; + XCTAssert([btnIcon isEqualToString:icon], @"First character in button title should equal FA icon"); +} + +@end diff --git a/BButtonDemoTests/en.lproj/InfoPlist.strings b/BButtonDemoTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/BButtonDemoTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f54bfbc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +## How To Contribute + +Please follow these sweet [contribution guidelines](https://github.com/jessesquires/HowToContribute). diff --git a/FontAwesomeIcons.html b/FontAwesomeIcons.html deleted file mode 100644 index b9b0f98..0000000 --- a/FontAwesomeIcons.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FAIconGlass
FAIconMusic
FAIconSearch
FAIconEnvelope
FAIconHeart
FAIconStar
FAIconStarEmpty
FAIconUser
FAIconFilm
FAIconThLarge
FAIconTh
FAIconThList
FAIconOk
FAIconRemove
FAIconZoomIn
FAIconZoomOut
FAIconOff
FAIconSignal
FAIconCog
FAIconTrash
FAIconHome
FAIconFile
FAIconTime
FAIconRoad
FAIconDownloadAlt
FAIconDownload
FAIconUpload
FAIconInbox
FAIconPlayCircle
FAIconRepeat
FAIconRefresh
FAIconListAlt
FAIconLock
FAIconFlag
FAIconHeadphones
FAIconVolumeOff
FAIconVolumeDown
FAIconVolumeUp
FAIconQrcode
FAIconBarcode
FAIconTag
FAIconTags
FAIconBook
FAIconBookmark
FAIconPrint
FAIconCamera
FAIconFont
FAIconBold
FAIconItalic
FAIconTextHeight
FAIconTextWidth
FAIconAlignLeft
FAIconAlignCenter
FAIconAlignRight
FAIconAlignJustify
FAIconList
FAIconIndentLeft
FAIconIndentRight
FAIconFacetimeVideo
FAIconPicture
FAIconPencil
FAIconMapMarker
FAIconAdjust
FAIconTint
FAIconEdit
FAIconShare
FAIconCheck
FAIconMove
FAIconStepBackward
FAIconFastBackward
FAIconBackward
FAIconPlay
FAIconPause
FAIconStop
FAIconForward
FAIconFastForward
FAIconStepForward
FAIconEject
FAIconChevronLeft
FAIconChevronRight
FAIconPlusSign
FAIconMinusSign
FAIconRemoveSign
FAIconOkSign
FAIconQuestionSign
FAIconInfoSign
FAIconScreenshot
FAIconRemoveCircle
FAIconOkCircle
FAIconBanCircle
FAIconArrowLeft
FAIconArrowRight
FAIconArrowUp
FAIconArrowDown
FAIconShareAlt
FAIconResizeFull
FAIconResizeSmall
FAIconPlus
FAIconMinus
FAIconAsterisk
FAIconExclamationSign
FAIconGift
FAIconLeaf
FAIconFire
FAIconEyeOpen
FAIconEyeClose
FAIconWarningSign
FAIconPlane
FAIconCalendar
FAIconRandom
FAIconComment
FAIconMagnet
FAIconChevronUp
FAIconChevronDown
FAIconRetweet
FAIconShoppingCart
FAIconFolderClose
FAIconFolderOpen
FAIconResizeVertical
FAIconResizeHorizontal
FAIconBarChart
FAIconTwitterSign
FAIconFacebookSign
FAIconCameraRetro
FAIconKey
FAIconCogs
FAIconComments
FAIconThumbsUp
FAIconThumbsDown
FAIconStarHalf
FAIconHeartEmpty
FAIconSignout
FAIconLinkedinSign
FAIconPushpin
FAIconExternalLink
FAIconSignin
FAIconTrophy
FAIconGithubSign
FAIconUploadAlt
FAIconLemon
FAIconPhone
FAIconCheckEmpty
FAIconBookmarkEmpty
FAIconPhoneSign
FAIconTwitter
FAIconFacebook
FAIconGithub
FAIconUnlock
FAIconCreditCard
FAIconRss
FAIconHdd
FAIconBullhorn
FAIconBell
FAIconCertificate
FAIconHandRight
FAIconHandLeft
FAIconHandUp
FAIconHandDown
FAIconCircleArrowLeft
FAIconCircleArrowRight
FAIconCircleArrowUp
FAIconCircleArrowDown
FAIconGlobe
FAIconWrench
FAIconTasks
FAIconFilter
FAIconBriefcase
FAIconFullscreen
FAIconGroup
FAIconLink
FAIconCloud
FAIconBeaker
FAIconCut
FAIconCopy
FAIconPaperClip
FAIconSave
FAIconSignBlank
FAIconReorder
FAIconListUl
FAIconListOl
FAIconStrikethrough
FAIconUnderline
FAIconTable
FAIconMagic
FAIconTruck
FAIconPinterest
FAIconPinterestSign
FAIconGooglePlusSign
FAIconGooglePlus
FAIconMoney
FAIconCaretDown
FAIconCaretUp
FAIconCaretLeft
FAIconCaretRight
FAIconColumns
FAIconSort
FAIconSortDown
FAIconSortUp
FAIconEnvelopeAlt
FAIconLinkedin
FAIconUndo
FAIconLegal
FAIconDashboard
FAIconCommentAlt
FAIconCommentsAlt
FAIconBolt
FAIconSitemap
FAIconUmbrella
FAIconPaste
FAIconUserMd
- - diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..28ffd45 --- /dev/null +++ b/LICENSE @@ -0,0 +1,26 @@ +BButton - copyright (c) 2012, Mathieu Bolard, Jesse Squires. All rights reserved. + +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. + + + +Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome + +The Font Awesome font is licensed under the SIL Open Font License: http://scripts.sil.org/OFL + +Font Awesome CSS, LESS, and SASS files are licensed under the MIT License: http://opensource.org/licenses/mit-license.html + +The Font Awesome pictograms are licensed under the CC BY 3.0 License: http://creativecommons.org/licenses/by/3.0 diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 47404dc..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,32 +0,0 @@ -Edited by Jesse Squires -http://www.hexedbits.com - - - -BButton -------- -BSD 3-Clause License -Copyright (c) 2012, Mathieu Bolard. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - -FontAwesome ------------ -* The Font Awesome font is licensed under the SIL Open Font License: http://scripts.sil.org/OFL - -* Font Awesome CSS, LESS, and SASS files are licensed under the MIT License: http://opensource.org/licenses/mit-license.html - -* The Font Awesome pictograms are licensed under the CC BY 3.0 License: http://creativecommons.org/licenses/by/3.0 - -* Attribution is no longer required in Font Awesome 3.0, but much appreciated: "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" \ No newline at end of file diff --git a/README.md b/README.md index 7cef54b..d88ea04 100644 --- a/README.md +++ b/README.md @@ -1,97 +1,94 @@ -#BButton 2.0 +# BButton [![Build Status](https://secure.travis-ci.org/jessesquires/BButton.svg)](http://travis-ci.org/jessesquires/BButton) [![Version Status](http://img.shields.io/cocoapods/v/BButton.png)][docsLink] [![license MIT](http://img.shields.io/badge/license-MIT-orange.png)][mitLink] -BButton is a subclass of UIButton that looks like the [Twitter Bootstrap 2.3.1](http://twitter.github.com/bootstrap) buttons. +[Twitter Bootstrap](http://getbootstrap.com) buttons for iOS -Forked from [@mattlawer / BButton](https://github.com/mattlawer/BButton) and refactored for more awesome. - -Includes [@leberwurstsaft / FontAwesome-for-iOS](https://github.com/leberwurstsaft/FontAwesome-for-iOS), fixed for iOS from the original [FontAwesome](http://fortawesome.github.com/Font-Awesome/). +`BButton` is a subclass of `UIButton` that is styled like the Twitter Bootstrap buttons, and is drawn entirely with `CoreGraphics`. Buttons can be styled as Bootstrap [version 2](http://getbootstrap.com/2.3.2/) or [version 3](http://getbootstrap.com). ![BButton Screenshot 1][img1]      ![BButton Screenshot 2][img2] -### Notable changes +## Requirements -* Up-to-date for iOS 5.0+, ARC, Storyboards -* Custom initialization methods for easier creation -* Option to show button 'disabled' state -* New button type options -* FontAwesome already included -* Refactored to be much cleaner, better organized +* iOS 6.0+ +* ARC ## Installation -### From [CocoaPods](http://www.cocoapods.org) - - pod `BButton` - -### From source +```` +pod 'BButton' +```` +Otherwise, drag the `BButton/` folder to your project. -* Drag the `BButton/` folder to your project (make sure you copy all files/folders) -* `#import "BButton.h"` -* Add `Fonts provided by application` key to `Info.plist` and include `FontAwesome.ttf` +Then add the `Fonts provided by application` key to `Info.plist` and include `FontAwesome.ttf` - +![plist][img3] -## How To Use +## Getting Started -### With Storyboards +See the demo project (`BButtonDemo.xcodeproj`) and [FontAwesome](http://fontawesome.io) for list of icons. -Create a `UIButton` and change its class to `BButton` +## Documentation - +Documentation is [available here][docsLink] via [CocoaDocs](http://cocoadocs.org). Thanks [@CocoaDocs](https://twitter.com/CocoaDocs)! -### Create programmatically +## Customization -Initialize with any of the following methods: +* Set corner radius for all buttons via `UIAppearance` ````objective-c -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type -- (id)initWithFrame:(CGRect)frame type:(BButtonType)type icon:(FAIcon)icon fontSize:(CGFloat)fontSize -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor -- (id)initWithFrame:(CGRect)frame color:(UIColor *)aColor icon:(FAIcon)icon fontSize:(CGFloat)fontSize -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon type:(BButtonType)type -+ (BButton *)awesomeButtonWithOnlyIcon:(FAIcon)icon color:(UIColor *)color +[[BButton appearance] setButtonCornerRadius:[NSNumber numberWithFloat:0.0f]]; ```` -**See the included demo project `BButtonDemo.xcodeproj`** +![BButton Screenshot 3][img4]      ![BButton Screenshot 4][img5] -**See `FontAwesomeIcons.html` for list of icons** +## How To Contribute -## Apps Using This Control +Please follow these sweet [contribution guidelines](https://github.com/jessesquires/HowToContribute). -[Hemoglobe](http://bit.ly/hemoglobeapp) +## Credits -[iPaint uPaint](http://bit.ly/ipupappstr) +Created by [@mattlawer](https://twitter.com/mattlawer) (Original project here: [@mattlawer / BButton](https://github.com/mattlawer/BButton)). -[Audiotrip](https://itunes.apple.com/us/app/audiotrip/id569634193?mt=8&ign-mpt=uo%3D4) +Forked, refactored, updated, maintained by [@jesse_squires](https://twitter.com/jesse_squires). -*[Contact me](mailto:jesse.d.squires@gmail.com) to have your app listed here.* +Many thanks to [the contributors](https://github.com/jessesquires/BButton/graphs/contributors) of this project. + +## Apps Using This Control -##[BButton](https://github.com/mattlawer/BButton) License +* [Idealyzer](https://itunes.apple.com/us/app/idealyzer-research-keywords/id991571238?ls=1&mt=8) +* [Gitty for GitHub](https://itunes.apple.com/us/app/gitty-for-github/id645696309?mt=8) +* [Hemoglobe](http://bit.ly/hemoglobeapp) +* [Audiotrip](https://itunes.apple.com/us/app/audiotrip/id569634193?mt=8) +* [iExplorer for DeviantART](https://itunes.apple.com/us/app/iexplorer-for-deviantart/id657212778?mt=8) +* [Travel Delay NYC](https://itunes.apple.com/us/app/train-delay-nyc-subway-status/id384027573?mt=8) +* [Libraries for Developers](https://itunes.apple.com/us/app/libraries-for-developers/id653427112?mt=8) +* [CPU Monitor](https://itunes.apple.com/us/app/cpumonitor/id680137811?mt=8) +* [OpenWatch](https://itunes.apple.com/us/app/openwatch-free-video-streaming/id642680756?mt=8) +* [VSNotes](https://itunes.apple.com/us/app/vsnotes/id695433001?mt=8) +* [Crew Scout](https://itunes.apple.com/us/app/crew-scout/id721124938?mt=8) +* [Chronorea](https://itunes.apple.com/us/app/chronorea-interventions-manager/id813086719?mt=8) +* [MA Mobile](https://itunes.apple.com/us/app/ma-mobile/id447421885?mt=8) -Edited and refactored by Jesse Squires, April 2013. +## License -[BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) +`BButton` is released under an [MIT License][mitLink]. See `LICENSE` for details. -Copyright (c) 2012, Mathieu Bolard -All rights reserved. +> Copyright © 2012, Mathieu Bolard, Jesse Squires. All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +## [Font Awesome](http://fortawesome.github.com/Font-Awesome) by Dave Gandy -* Neither the name of Mathieu Bolard, mattlawer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +> The Font Awesome font is licensed under the [SIL Open Font License](http://scripts.sil.org/OFL) +> +> Font Awesome CSS, LESS, and SASS files are licensed under the [MIT License][mitLink] +> +> The Font Awesome pictograms are licensed under the [CC BY 3.0 License](http://creativecommons.org/licenses/by/3.0) -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Mathieu Bolard BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +[docsLink]:http://cocoadocs.org/docsets/BButton +[mitLink]:http://opensource.org/licenses/MIT -##[FontAwesome](https://github.com/FortAwesome/Font-Awesome) License +[img1]:https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/screenshot0.png +[img2]:https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/screenshot1.png -* The Font Awesome font is licensed under the [SIL Open Font License](http://scripts.sil.org/OFL) -* Font Awesome CSS, LESS, and SASS files are licensed under the [MIT License](http://opensource.org/licenses/mit-license.html) -* The Font Awesome pictograms are licensed under the [CC BY 3.0 License](http://creativecommons.org/licenses/by/3.0) -* Attribution is no longer required in Font Awesome 3.0, but much appreciated: - * *"Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"* +[img3]:https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/plistfont.png -[img1]:https://raw.github.com/jessesquires/BButton/master/Screenshots/screenshot-1.png -[img2]:https://raw.github.com/jessesquires/BButton/master/Screenshots/screenshot-2.png \ No newline at end of file +[img4]:https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/screenshot2.png +[img5]:https://raw.githubusercontent.com/jessesquires/BButton/master/Screenshots/screenshot3.png diff --git a/Screenshots/plistfont.png b/Screenshots/plistfont.png new file mode 100644 index 0000000..e93af0c Binary files /dev/null and b/Screenshots/plistfont.png differ diff --git a/Screenshots/screenshot-1.png b/Screenshots/screenshot-1.png deleted file mode 100644 index 90086aa..0000000 Binary files a/Screenshots/screenshot-1.png and /dev/null differ diff --git a/Screenshots/screenshot-2.png b/Screenshots/screenshot-2.png deleted file mode 100644 index 0342e10..0000000 Binary files a/Screenshots/screenshot-2.png and /dev/null differ diff --git a/Screenshots/screenshot-3.png b/Screenshots/screenshot-3.png deleted file mode 100644 index 31dcc86..0000000 Binary files a/Screenshots/screenshot-3.png and /dev/null differ diff --git a/Screenshots/screenshot-4.png b/Screenshots/screenshot-4.png deleted file mode 100644 index d4f217d..0000000 Binary files a/Screenshots/screenshot-4.png and /dev/null differ diff --git a/Screenshots/screenshot0.png b/Screenshots/screenshot0.png new file mode 100644 index 0000000..421dd51 Binary files /dev/null and b/Screenshots/screenshot0.png differ diff --git a/Screenshots/screenshot1.png b/Screenshots/screenshot1.png new file mode 100644 index 0000000..dd9820e Binary files /dev/null and b/Screenshots/screenshot1.png differ diff --git a/Screenshots/screenshot2.png b/Screenshots/screenshot2.png new file mode 100644 index 0000000..1b55683 Binary files /dev/null and b/Screenshots/screenshot2.png differ diff --git a/Screenshots/screenshot3.png b/Screenshots/screenshot3.png new file mode 100644 index 0000000..653e33d Binary files /dev/null and b/Screenshots/screenshot3.png differ