Open Ying1986 opened 7 years ago
Pass you custom button with desired frame: https://github.com/ealeksandrov/EAIntroView/blob/6c4f11637f0a8a8b5fe14d14d7c032d701eacadb/Example/Source/ViewController.m#L127-L136
@ealeksandrov
This library is use AutoLayout inner code, so button height changed fit heigh.
So I think you have to add skipbutton height property and add constraint height if user set it,
Can you create skip button with height 100 with your code?
Sounds legit. I'll check this.
Confirmed, will make a note for improving customization in next releases.
Any update to set height of button ?
When customize the skip button, the height is more than 40dp, and I set btn.layer.cornerRadius equals 20, and masks to bouds yes, but the btn was not rounded correctly.
There is a workaround. Create blank UIImage of a size that you want you button be and set is as a background.
let skipButton = UIButton(type: .custom)
skipButton.frame = CGRect(x: 0, y: parentView.bounds.size.height - 50, width: parentView.bounds.size.width, height: 50)
let blankImage = UIImage.emptyImage(with: skipButton.frame.size)
skipButton.setBackgroundImage(blankImage, for: .normal)
skipButton.setTitle("Пропустить", for: .normal)
skipButton.backgroundColor = .charcoalGrey
skipButton.setTitleColor(.white, for: .normal)
skipButton.titleLabel?.font = UIFont.systemFont(ofSize: 16)
intro.skipButton = skipButton;
intro.skipButtonY = 50;
intro.skipButtonAlignment = .center
Use this extension to create a blank image:
extension UIImage {
static func emptyImage(with size: CGSize) -> UIImage? {
UIGraphicsBeginImageContext(size)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
How can I change the height of skip button?