• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

KBRoundedButton allows you to create beautiful rounded rect button with dynamic colors and activity indicator, completely in Interface Builder.

KBRoundedButton

allows you to create beautiful rounded rect button with dynamic colors and activity indicator, completely in Interface Builder.

Animation

Button's corners alre always rounded to half of it's height.

Installation

KBRoundedButton is available via CocoaPods. To use it in your app simply add:

pod 'KBRoundedButton'

Setting colors

You can set colors for each state of the button in both code and Interface builder. Both background colors and title colors are supported. Set of colors:

@property (nonatomic, strong) UIColor *backgroundColorForStateNormal;
@property (nonatomic, strong) UIColor *backgroundColorForStateSelected;
@property (nonatomic, strong) UIColor *backgroundColorForStateHighlighted;
@property (nonatomic, strong) UIColor *backgroundColorForStateSelectedAndHighlighted;
@property (nonatomic, strong) UIColor *backgroundColorForStateDisabled;

@property (nonatomic, strong) UIColor *titleColorForStateNormal;
@property (nonatomic, strong) UIColor *titleColorForStateSelected;
@property (nonatomic, strong) UIColor *titleColorForStateHighlighted;
@property (nonatomic, strong) UIColor *titleColorForStateSelectedAndHighlighted;
@property (nonatomic, strong) UIColor *titleColorForStateDisabled;

Setting them in IB is very easy: all you have to do is to set a class of your button to KBRoundedButton and User Defined Runtime Attributes for a subset of properties from above.

Animation

Colors are set by creating an UIImage of 1x1 size in given color and placing it as a backgroundImage of button.

Setting shadow

KBRoundedButton has a property

@property (nonatomic, assign) BOOL shadowEnabled;

which can be also set in IB and enables bottom shadow for a button. Due to the fact that internal implementation uses CALayer's cornerRadius property altogether with clipsToBounds it was unable to use native shadow. Method

- (void)addBottomShadow

creates a separate view with size of the button and places it below the button in view hierarchy.

Activity Indicator

KBRoundedButton's last property

@property (nonatomic, assign) BOOL working;

displays activity indicator when set to YES and restores original title when set to NO. See Log in button for a realtime example.

License

KBRoundedButton is under MIT license. See LICENSE file for more info.

More Repositories

1

XcodeSwiftSnippets

Swift 4 code snippets for Xcode
Python
1,755
star
2

UIForLumberjack

iOS UI library to display CocoaLumberjack logs on iOS device
Objective-C
63
star
3

KBContactsSelection

Easily search and select contacts in your iOS Address Book and redirect to Mail or Messages with results.
Objective-C
62
star
4

Camouflage

Read and write NSData to iOS Camera Roll as .bmp file and share it between apps!
C
48
star
5

AFAbstractRESTClient

simple abstract solution to deal with REST webservices using AFNetworking
Objective-C
30
star
6

SwiftTeamSelect

Swift implementation of SpriteKit SKScene with scrollable team selection
Swift
27
star
7

AppSettings

Simple tool to allow automatically serialize and deserialize objects to NSDictionary. Originally created to simply manage app settings in NSUserDefaults.
Objective-C
22
star
8

UITableViewCellAnimation

Animating UITableViewCell size and text change using Auto Layout and automatic dimension
Swift
15
star
9

SynchroKit

framework that helps syncing data in iOS environment
Objective-C
9
star
10

NetworkLib

CocoaPods static library test project
Objective-C
6
star
11

ReposBrowser

CocoaPods project that uses NetworkLib as local library
Objective-C
4
star
12

CalendarInvitesCleaner

python script for cleaning pending OS X Calendar.app invites
Python
3
star
13

ReposBrowserStatic

CocoaPods project that uses NetworkLib as static library
Objective-C
2
star
14

SubTrans

Subtitles Translation Helper
Java
2
star
15

SynchroKitTesterServer

django server app for SynchroKitTester
Python
1
star
16

SynchroKitTester

Objective-C
1
star
17

AutolayoutExample

Example project showing how to reset NSLayoutConstraints after a change
Objective-C
1
star
18

ParseCollectionsSwiftBug

Swift
1
star