prolificinteractive / Caishen

A Payment Card UI & Validator for iOS
MIT License
766 stars 119 forks source link

Fix Placeholders #111

Closed saltyskip closed 7 years ago

saltyskip commented 7 years ago

Currently the library is trying to draw placeholders twice. The empty function drawPlaceholders rewrites the placeholder to empty. This PR removes the drawing over

KarlHarnois commented 7 years ago

@saltyskip could that be why I can't set the placeholder's insets via the following methods?

override func textRect(forBounds bounds: CGRect) -> CGRect
override func editingRect(forBounds bounds: CGRect) -> CGRect
override func placeholderRect(forBounds bounds: CGRect) -> CGRect
KarlHarnois commented 7 years ago

I removed drawPlaceholder(in rect: CGRect) in a fork and now the placeholder is "doubled" in a weird way (one is at desired inset 10 and the other is at inset 0, example placeholder being YY). screen shot 2017-05-10 at 5 34 26 pm

DannyVancura commented 7 years ago

Hi, the reason for drawPlaceholder to be overridden with an empty function body was what @KarlHarnois mentioned:

Without this override, the placeholder is drawn twice on the text field. When running your branch, you'll notice that some placeholders occasionally appear darker than they should due to this issue.

@KarlHarnois : In order to create leading/trailing insets for the text field content, you can use imageViewLeadingInset, imageViewTrailingInset, accessoryButtonLeadingInset, accessoryButtonTrailingInset which create some padding around the card image view and accessory button respectively.

DannyVancura commented 7 years ago

Issue with duplicated placeholders.

HardikDG commented 5 years ago

@KarlHarnois Do you find any method find placeholder insets? I am having the same issue, with above method not able to set placeholder insets