Improve Skip Button customization
Ying1986 opened this issue · 7 comments
How can I change the height of skip button?
I placed page control to vertical center.
Pass you custom button with desired frame:
EAIntroView/Example/Source/ViewController.m
Lines 127 to 136 in 6c4f116
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?
EAIntroView/Example/Source/ViewController.m
Lines 127 to 136 in 6c4f116
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
}
}