SCLAlertView-Swift icon indicating copy to clipboard operation
SCLAlertView-Swift copied to clipboard

kButtonHeight not working

Open ukmarn opened this issue 9 years ago • 2 comments

I have searched through example and wiki but couldn't find anything. The problem is that following code is not working on button height:

let appearance = SCLAlertView.SCLAppearance(
            kWindowWidth: 275,
            kTitleFont: UIFont(name: "SourceSansPro-Regular", size: 24)!,
            kTitleTop: 40,
            kTitleHeight: 40,
            kButtonHeight: 60,
            kTextFont: UIFont(name: "SourceSansPro-Light", size: 16)!,
            kButtonFont: UIFont(name: "SourceSansPro-Semibold", size: 18)!,
            buttonCornerRadius: 0,
            showCloseButton: false,
            shouldAutoDismiss: false,
            showCircularIcon: false
        )

      let alert = SCLAlertView(appearance: appearance)

I have 2 buttons. If I increase kButtonHeight from 40 to 60 I can see that padding between 2 buttons has increased (that means button height was changed right?) but the button stays the same size. Look at screenshots below.

photo 24-08-16 18 55 08 photo 24-08-16 18 56 15

Also is there any way to set padding to left and right for the text under title?

Thanks for help and btw, awesome lib!

ukmarn avatar Aug 24 '16 16:08 ukmarn

+1. kButtonHeight is treated as the button's height + margins, and the actual button height is hardcoded to 35 pts. We should have a separate parameter for the margins and the button height itself. I am working on a project for the elderly, and 35 pts is too small of a touch target for them.

A size of 35pts for a touch target also directly violates the Apple Human Interface Guidelines which state:

Provide ample spacing for interactive elements. Try to maintain a minimum tappable area of 44pt x 44pt for all controls.

willrichman avatar Dec 28 '16 21:12 willrichman

I forked a branch that fixes this issue, and submitted a pull request that fixes this issue. Hopefully it will be accepted for you soon.

AdamLee321 avatar Feb 25 '20 14:02 AdamLee321