Coder Social home page Coder Social logo

bbutton's Introduction

#BButton 2.0

BButton is a subclass of UIButton that looks like the Twitter Bootstrap 2.3.1 buttons.

Refactored by @jessesquires, April 2013.

Includes @leberwurstsaft / FontAwesome-for-iOS, fixed for iOS from the original FontAwesome.

BButton Screenshot 1      BButton Screenshot 2

Notable changes

  • 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

Installation

pod 'BButton'

From source

  • 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

How To Use

With Storyboards

Create a UIButton and change its class to BButton

Under 'User Defined Runtime Attributes' Define At Least Type to a integer of your choice. Other properties can be set this way for additional styling.

Create programmatically

Initialize with any of the following methods:

- (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

See the included demo project BButtonDemo.xcodeproj

See FontAwesomeIcons.html for list of icons

Apps Using This Control

Hemoglobe

iPaint uPaint

Audiotrip

Contact me to have your app listed here.

##BButton License

MIT License

Copyright (c) 2013 Mathieu Bolard

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.

##FontAwesome License

##Contact

[email protected]
http://mathieubolard.com
http://twitter.com/mattlawer

bbutton's People

Contributors

aw-emberex avatar elwerene avatar jessesquires avatar kbessiere avatar leberwurstsaft avatar mattlawer avatar skywinder avatar wagyu298 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bbutton's Issues

BButton and autolayout

BButton doesn't seem to work correctly when using auto layout.

Below are the button as laid out in Interface Builder and the resulting BButton instance in my app. As you can see the button is hugging the dimensions of the button label instead of using the correct dimensions.

Screen Shot 2013-03-27 at 17 05 22

Screen Shot 2013-03-27 at 17 08 51

FA icons always appear as white rectangle

No matter what instantiation I use or what FontAwesome icon or BButtonType I always get a simple empty white rectangle as an icon in the GUI of the Simulator or on the iPhone for the BButton I create.

e.g.:
BButton *button = [BButton awesomeButtonWithOnlyIcon:FAIconTwitter type:BButtonTypeInverse];
[self.view addSubview:button];

What am I doing wrong?

How to properly update awesomeIcon?

I have a BButton, acting as a toggle, that utilizes the FAPlay icon before pressed, but when pressed, wants to switch to the FAStop icon. Using

- (void)addAwesomeIcon:(FAIcon)icon beforeTitle:(BOOL)before

simply adds a new icon to the existing button.

What's the recommended way of changing the button icon? instantiate a new button? I'm in the middle of creating a new API call, updateAwesomeIcon, but want to make sure there's not a better recommended way of doing this.

SIG Abort after download and compile

I've just downloaded the bbutton and it compiles without problem. But when I click, it crashes.

Impossible to undestand why for the moment.

Debug gives me a crash on
UIColor* border = [self darkenColor:_color value:0.06];
in drawRect of BButton.m and says that _color is not of type UIColor and so it doesn't recognize the .CGColor

imageView

I'm trying to set and image icon on these, and I'm getting some odd results. Looks like when I set the imageView with and image... it takes up the left half of the button and the titleLabel gets pushed to the right and truncated the middle. Am I doing something wrong here?

No "Disabled" State

When I set .enabled = NO on a BButton, it no longer accepts touch events but it isn't obvious to the user that the button is disabled. I was imagining slightly greying out the current button color, similar to other controls.

Is this a bug or do we need to write it?

iOS 7 style BButton

BButton works fine, but has anyone done an iOS 7 style modification yet? A flatter version (without the border shadow effects), like the buttons seen in iOS 7 phone app during a call.

Numbers + FontAwesome Don't Render Correctly

I don't know if this is really an issue with BButton as much as it's with FontAwesome, but I wasn't sure where I would bring this up in that case. It seems when using an icon along with text, numbers in the text get rendered strangely and without a shadow. Is this an issue with the FA font itself or something that can be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.