Latest 1.1.4
Homepage https://github.com/alexhillc/AXStateButton
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

AXStateButton is a simple UIButton subclass that offers state-based button customization akin to that of Apple’s. The idea is nothing fancy, but can be used as the building blocks to create something a bit more complex. All it takes to get started is:

AXStateButton *button = [AXStateButton button];

// some arbitrary customizations
;
;
;

;
;

// customize the rest of your button...

[self.view addSubview:button];

"Well, what properties are state-configurable?"

  • Tint color
  • Background color
  • Alpha
  • Title alpha
  • Image alpha
  • Corner radius
  • Border color
  • Border width
  • Transform rotation (x, y, z)
  • Transform scale
  • Shadow color
  • Shadow opacity
  • Shadow offset
  • Shadow radius
  • Shadow path

Todo?

  • Custom view for state

Other useful things

You can also adjust the animation duration of your state transitions:

button.controlStateAnimationDuration = 0.1;

On top of that, you can change the timing function used when animating control state changes:

button.controlStateAnimationTimingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

Or, you can disable animations all together:

button.animateControlStateChanges = NO;

For convenience, it’s possible to access your set values:

CGFloat cornerRadius = ;
// great success!

Contributions

If you see a bug, you are welcome to open a Github issue and I will attempt to get to it as soon as I can. Of course, you are also welcome to fork the repo and create a pull request with your changes. I’d be happy to look them over!

Latest podspec

{
    "name": "AXStateButton",
    "version": "1.1.4",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "summary": "A simple UIButton subclass that allows for extensive button state customization.",
    "homepage": "https://github.com/alexhillc/AXStateButton",
    "authors": {
        "Alex Hill": "[email protected]"
    },
    "source": {
        "git": "https://github.com/alexhillc/AXStateButton.git",
        "tag": "v1.1.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Source/*.{h,m}",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This