Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
This extension provides the ability to easily create a UIButton with a flat style, a border or both.
To learn more about this project, please visit it on GitHub.
Give UIButtonFlat a try without having to type a single line of code with the UIButtonFlat Demo.
Simply add UIButtonFlat via Swift Package Manager to your project... that's it!
You can choose to create a UIButtonFlat control in the same way that you would create a stock UIButton control, either via Storyboards, programmatically or through a mixture of the two.
- Select the UIButton that you wish to use
- Switch to the Identity Inspector
- Update the UIButton's class to 'UIButtonFlat'
- Switch to the Attributes Inspector
- Switch Type to 'Custom'
- You can find the configuration options under the Button Flat heading
UIButtonFlat. Then create a UIButtonFlat control in the same way that you would create a UIButton control, except that instead of using UIButton, use the UIButtonFlat type. Because UIButtonFlat in an extension of UIButton, all of UIButton's functions will be inherited. Please note that if you are creating a UIButtonFlat from scratch and not connecting to a button that you've either fully or partially configured in a Storyboard, you will need to declare it's type as
.custom like so:
let button: UIButtonFlat = UIButtonFlat(type: .custom)
|flatBackground||Bool||false||Determines if a flat background will be drawn|
|border||Bool||false||Determines if a border will be drawn|
|borderColor||UIColor||.clear||The color of the border|
|borderWidth||CGFloat||1||The width of the border|
|corner||Bool||false||Determines if a rounded corner will be applied|
|cornerRadius||CGFloat||0||The radius of the corner|
|tintColor||UIColor||self.view.tintColor||The color used when drawing a flat background|
|titleLabel.textColor||UIColor||.white||The color used by the title label; ignored if flatBackground is set to false|
|Last commit: 1 week ago|
You may find interesting
v1.0.2 - 2021-02-19T12:14:37
Resolved an issue that could cause the button's background to not properly render when it's containing view controller was not the primary view controller.