raulriera/TextFieldEffects

HoshiTextField not getting padding.

Closed this issue · 5 comments

I want to give my textfield some padding from left but my code not applying to
HoshiTextField but that code working in normal state please help me out code
that is I am using right now as follows if you want to check out you can : ->

    let rect = CGRect(x: 0, y: 0, width: 100, height: self.normalotxt.frame.height)        
    let paddingView = UIView(frame: rect)
    normalotxt.leftView = paddingView
    normalotxt.leftViewMode = UITextFieldViewMode.always

Hi,

The effects don’t take into consideration the left and right views. Sadly they are meant to use as is, or will require subclassing to accommodate for what you are trying to do

My use here is to put some space before text and I want to put image on that place. Left side image that look as if it is on left side and text is on right side. It will look pretty as well. But in here I haven't found any same thing so I decided to put some space earlier and put image on that place. But still, if you have any assistance in this regard that will be most welcome from my side.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 3 days if no further activity occurs.

solved it. I was also trying to do the same. adding image in front of textfield.

just open HoshiTextField class and find this line (Line no. 74 for me)

private let textFieldInsets = CGPoint(x:0, y: 12)

Just change the value of x to 20 or anything. This will add padding to placeholder and text. :)

konop commented

Also had this issue @keshu1024 had a great solution but be aware to clean and rebuild.