Latest 1.0.4
Homepage https://github.com/xpd54/XpdButtons
License MIT
Platforms ios 8.0
Authors

Build Status
Version
License
Platform

firstScreen
firstScreen

XpdButtons is a library which generate a view with multiple buttons dynamically arrange according to button title length. Number of row in one page view have to be fix and if there is more buttons, it will show up in next page view.

Usage

XpdButtonContainer

XpdButtonContainer creates a controller where you can set your button properties and the way button looks. Then you can get a UIView in which buttons are properly arranged.

Creating button view

buttonproperties is an Array which holds dictionary of buttonInfo and title.
#import<XpdButtons/XpdButtonContainer.h> In your .h file.

XpdButtonContainer *buttonPageController = [[XpdButtonContainer alloc] init];
// self <--- in which viewContoller you gonna use the view.
buttonPageController.delegate = self;
buttonPageController.buttonProperties = buttonproperties; // NSArray
// Set your other properties for buttons.
buttonPageController.numberOfMaxRow = 3; // Default is 2
UIView *buttonView = [buttonPageController getXpdButtonsViewForParentViewController:self];

XpdButtonAction

XpdButtonAction @protocol for detecting buttons tap.
Implement following method to know when buttons got clicked.
- (void) buttonGetClicked:(XpdButton *)button;

XpdButtonContainer @property

buttonProperties

buttonProperties if an Array of Dictionary with two keys.

  1. title :- title is which gonna be shown on button title.
  2. buttonInfo :- buttonInfo is Dictionary.

Tips :- In following delegate method buttonInfo will be useful to take action on button tap.

- (void) buttonGetClicked:(XpdButton *)button;

Example
NSArray *properties = @[
                            @{
                                @"title" : @"button 1",
                                @"buttonInfo" : @{@"key" : @"value"}
                            },
                            @{
                                @"title" : @"button 2",
                                @"buttonInfo" : @{@"key" : @"value"}
                            }];
- (void) buttonGetClicked:(XpdButton *)button {
            if ([[button.buttonInfo objectForKey:@"somekey"] isEqualToString:@"somevalue"]) {
                // Do something
            }
            if ([button.title isEqualToString:@"Button 1"]) {
                // Do something
            }                                           
        }

numberOfMaxRow

numberOfMaxRow How many maximum row should be in one page view. Default number of maximum row is 2

buttonBorderColor

buttonBorderColor Set button border color. Default is black.

buttonTitleColor

buttonTitleColor Set Button title color. Default is black.

buttonHighlightedTitleColor

buttonHighlightedTitleColor Set Button title color in Highlighted condition. Default is red.

pageIndicatorTintColor

pageIndicatorTintColor Set Page Indicator Tint color. Default is lightGray.

currentPageIndicatorTintColor

currentPageIndicatorTintColor Set Current Page indicator tint color. Default is black.

Method

-(UIView *) getXpdButtonsViewForParentViewController:(UIViewController *)parent;

Returns a view which holds all buttons which was set in buttonProperties

How to run Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

XpdButtons is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "XpdButtons"

Contribution

You wanna help to make it better and easy to use. Send me pull request 😃.
PS :- Send pull request on development branch.

Author

Ravi Prakash, [email protected]

License

XpdButtons is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "XpdButtons",
    "version": "1.0.4",
    "summary": "A UIView which provide multiple buttons arranged according to title lenght in pageViewController.",
    "description": "A UIView which provide multiple buttons arranged in pageViewController. Button layout depends on total number of buttons you want. It will club buttons dynamically according to length of title in one page other buttons will be in next page (which will comeup after horizontal scroll).",
    "homepage": "https://github.com/xpd54/XpdButtons",
    "screenshots": [
        "https://raw.githubusercontent.com/xpd54/XpdButtons/master/Example/Screenshots/screenshots_1.png",
        "https://raw.githubusercontent.com/xpd54/XpdButtons/master/Example/Screenshots/screenshots_2.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Ravi Prakash": "[email protected]"
    },
    "source": {
        "git": "https://github.com/xpd54/XpdButtons.git",
        "tag": "1.0.4"
    },
    "social_media_url": "https://twitter.com/xpd54",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "XpdButtons/Classes/**/*"
}

Pin It on Pinterest

Share This