Latest 0.0.1
Homepage https://github.com/shuoli84/SLFlexibleButton
License MIT
Platforms ios
Dependencies UIGlossyButton
Authors

A flexible button which utilize UIGlossyButton, able to supply the bezel through relative location.

Example

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    SLFlexibleButton *button = [[SLFlexibleButton alloc] init];
#define PV(x,y) [NSValue valueWithCGPoint:CGPointMake((x), (y))]
    button.buttonPoints = @[
            PV(0, 0),
            PV(10, -0.5),
            PV(0, -1),
            PV(-1, -1),
            PV(-10,-0.5),
            PV(-1,0)
    ];

    button.titleEdgeInsets = UIEdgeInsetsMake(3, 10, 3, 10);
    button.tintColor = [UIColor blueColor];
    ;
    ;
    button.frame = CGRectMake(button.frame.origin.x, button.frame.origin.y, 100, button.frame.size.height);
    [self.view addSubview:button];
}

The example code create a button like

Alt example

When specify the button point as negative value, if it is between [-1,0), then it is used as the percentage. if it is less than -1, then it is used as the tail absolute offset, -10 means (self.bounds.size.width – 10) for x;

point(10, -0.1) means with x as 10 and y as (self.bounds.size.height * (-0.1))

> 0: absolute point position
[-1, 0]: percentable position, -0.5 means the half.
<-1: reverse offset -10 means self.bounds.size.width - 10 for x. height for y

TODO

  • Add arc, curve support

Latest podspec

{
    "name": "SLFlexibleButton",
    "version": "0.0.1",
    "license": "MIT",
    "summary": "A button library which able to draw it self with bezel defined by relative location.",
    "homepage": "https://github.com/shuoli84/SLFlexibleButton",
    "authors": {
        "Shuo Li": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/shuoli84/SLFlexibleButton.git",
        "tag": "v0.0.1lw"
    },
    "source_files": "FlexibleButton/SLFlexibleButton.{h,m}",
    "dependencies": {
        "UIGlossyButton": []
    },
    "requires_arc": false
}

Pin It on Pinterest

Share This