-
-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom cancel button #42
Comments
Hi @RealBug, thanks for your contribution! Right you can use a custom open class CustomActionController: ActionController<CustomCell, ActionData, CustomHeaderView, SpotifyHeaderData, UICollectionReusableView, Void> {
public override init(nibName nibNameOrNil: String? = nil, bundle nibBundleOrNil: Bundle? = nil) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
settings.cancelView.showCancel = true
settings.cancelView.backgroundColor = .lightGray
// Add all needed settings
}
open override func viewDidLoad() {
cancelView = {
let cancelView = UIView(frame: CGRect(x: 0, y: 0, width: view.bounds.size.width, height: settings.cancelView.height))
cancelView.backgroundColor = settings.cancelView.backgroundColor
let button = UIButton()
button.backgroundColor = .white
button.setTitle("Cancel", for: .normal)
button.setTitleColor(.black, for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
cancelView.addSubview(button)
cancelView.addConstraints(
NSLayoutConstraint.constraints(withVisualFormat: "H:|-20-[button]-20-|", options: [], metrics: nil, views: ["button": button]) +
NSLayoutConstraint.constraints(withVisualFormat: "V:|-5-[button]-5-|", options: [], metrics: nil, views: ["button": button])
)
return cancelView
}()
super.viewDidLoad()
}
} We are planning to add support for a |
Awesome, thank you for your great work ! |
Your component is great!
I just regret that we can't customize the cancel button.
In the example of spotify, if you want to put a button with title in black (white by default, you can not modify it) and add margins to the left and right), how can you do it?
Thank you in advance
The text was updated successfully, but these errors were encountered: