Welcome to the documentation for ESFlatButton!
In this documentation, you will find information about how to use ESFlatButton, a custom flat button library for iOS.
Installation
To use ESFlatButton in your iOS project, follow these steps:
- Ensure you have Cocoapods installed.
- Add `pod ‘ESFlatButton’` to your project’s Podfile.
- Run `pod install` in your project directory.
- Import the ESFlatButton module wherever you want to use it:
import ESFlatButton
Basic Usage
To create an ESFlatButton, initialize it with a frame and set the necessary properties. Here’s a basic example:
// Create the button
let button = ESFlatButton(frame: CGRect(x: 0, y: 0, width: 200, height: 50))
// Set button properties
button.setTitle("Click Me", for: .normal)
button.setTitleColor(.white, for: .normal)
button.setBackgroundColor(.blue, for: .normal)
button.cornerRadius = 8
// Add the button to your view
view.addSubview(button)
In the above example, we initialize an ESFlatButton with a specific frame. We then set the title text, title color, background color, and corner radius of the button. Finally, we add the button to a view.
Properties
ESFlatButton provides the following properties to customize the appearance of your button:
- setTitle(_:for:): sets the button’s title for a specific state.
- setTitleColor(_:for:): sets the color of the button’s title for a specific state.
- setBackgroundColor(_:for:): sets the background color of the button for a specific state.
- cornerRadius: sets the corner radius of the button.