Latest 0.0.2
Homepage https://github.com/woxtu/UIButton-WithObject
License MIT
Platforms ios 5.0, requires ARC
Frameworks UIKit
Authors

CocoaPods

A category on UIButton that extends for adding target.

Usage

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIButton* foo = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.view addSubview:foo];

    UIButton* bar = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.view addSubview:bar];

    // Add a target and action with an object
    [foo addTarget:self
            action:@selector(call:withMessage:)
        withObject:@"foo!"
  forControlEvents:UIControlEventTouchUpInside];

    [bar addTarget:self
            action:@selector(call:withMessage:)
        withObject:@"bar!"
  forControlEvents:UIControlEventTouchUpInside];
}

- (IBAction)call:(id)sender withMessage:(NSString*)message {
    // Display an object passed
    NSLog(@"%@", message);
}

@end

Install

Use CocoaPods.

pod 'UIButton+WithObject'

License

Copyright (c) 2014 woxtu

Licensed under the MIT license.

Latest podspec

{
    "name": "UIButton+WithObject",
    "version": "0.0.2",
    "summary": "A category that extends for adding target.",
    "homepage": "https://github.com/woxtu/UIButton-WithObject",
    "license": {
        "type": "MIT",
        "file": "LICENSE-MIT"
    },
    "authors": {
        "woxtu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/woxtu/UIButton-WithObject.git",
        "tag": "0.0.2"
    },
    "source_files": "UIButton+WithObject/UIButton+WithObject.{h,m}",
    "platforms": {
        "ios": "5.0"
    },
    "requires_arc": true,
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This