Giter Club home page Giter Club logo

Comments (12)

m-junaid-butt avatar m-junaid-butt commented on May 28, 2024 1

@oleghnidets you are right. It is working in new version. Actually, you forgot to mention the pod version in ReadME file. By default, pod was pointing to 1.0.0 version instead of 1.1.1 that's why I was getting this issue. :(

Please update it in the ReadMe file and then close this issue. Thank you so much to quickly respond my issue. :)

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

Hi,
Thanks for reporting. I will take a look and try to fix ASAP.

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

@m-junaid-butt Tell me, please, have you updated the library to the latest version?

from tweetextfield.

m-junaid-butt avatar m-junaid-butt commented on May 28, 2024

@oleghnidets actually, I forked your repo and made my own changes to achieve that behaviour. Let me change my PodFile to point your updated repo. πŸ‘

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

To be honest, I cannot reproduce the issue. Please, download sample project, launch it. Tap Confirm button.
Actually, it sets correct placeholder position.

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

@m-junaid-butt Actually you don't have to specify pod version :) You have to use pod update.
Read guide for more details.

from tweetextfield.

Minitour avatar Minitour commented on May 28, 2024

Hi @oleghnidets,
was this issue fixed? I am using version 1.2.2 and I am still getting the described issue:
Setting text on the field programatically in viewDidLoad causes the placeholder label to overlay the text.

public override func viewDidLoad() {
        super.viewDidLoad()

       ...

        countryField.text = countryCode
        
    }

Do note that my controller is initialised programatically, and the textfield is loaded through the loadView function.

from tweetextfield.

Minitour avatar Minitour commented on May 28, 2024

Upon further inspection of the code, I noticed that minimizePlaceholder is being called, however since we set the text in viewDidLoad the frame is still 0. The current workaround is to set the text from viewDidAppear.

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

Hi,
Take a look, please, at #15
It is a newer version. I will post the update asap.

Now minimizePlaceholder is called only when a user taps on a text field. Although if you want to make the text field first responder you have to do it in viewDidAppear.

from tweetextfield.

Minitour avatar Minitour commented on May 28, 2024

@oleghnidets
In

open class TweePlaceholderTextField: UITextField 

When text is set:

open override var text: String? {
		didSet {
			setCorrectPlaceholderSize()
		}
	}

which invokes:

@objc private func setCorrectPlaceholderSize() {
		if let text = text, text.isEmpty == false {
			minimizePlaceholder()
		} else if isEditing == false {
			maximizePlaceholder()
		}
	}

which then calls minimizePlaceholder

@objc private func minimizePlaceholder() {
		bottomConstraint?.constant = -frame.height //<- height is 0

		UIView.animate(withDuration: placeholderDuration, delay: 0, options: [.preferredFramesPerSecond30], animations: {
			self.layoutIfNeeded()

			switch self.minimizationAnimationType {
			case .immediately:
				self.placeholderLabel.font = self.placeholderLabel.font.withSize(self.minimumPlaceholderFontSize)
			case .smoothly:
				self.minimizeFontAnimation.start()
			}
		}, completion: { _ in
			self.minimizeFontAnimation.stop()
		})
	}

from tweetextfield.

Minitour avatar Minitour commented on May 28, 2024

Seems like the code in release 1.2.2 does not match the code in the master branch.
Is 1.2.2 the latest release? or am I using an older version?

EDIT:
@oleghnidets didn't see the edit. my bad πŸ˜…thanks for the quick reply!

from tweetextfield.

oleghnidets avatar oleghnidets commented on May 28, 2024

Currently, it is beta version in master.
Sorry, because of lack of time, I cannot manage to update the library.

from tweetextfield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.