Comments (12)
@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.
Hi,
Thanks for reporting. I will take a look and try to fix ASAP.
from tweetextfield.
@m-junaid-butt Tell me, please, have you updated the library to the latest version?
from tweetextfield.
@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.
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.
@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.
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.
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.
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.
@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.
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.
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)
- Add support for UITextView HOT 16
- Without Storyboard HOT 1
- Framework via Carthage ins't working HOT 6
- Placeholder overlay with set text when the text is set in Interface builder HOT 3
- Problems when changing orientations HOT 13
- Notification Center KeyboardWillHide/Show HOT 2
- [Enhancement] custom placeholder color at active state HOT 3
- AutoLayout crashes in the recent commits HOT 8
- Leaks HOT 2
- cann't use UITextFieldDelegate? HOT 1
- Change font of the placeholder label HOT 7
- Not working with generic tableview HOT 1
- Add SPM support HOT 5
- ShowInfo option not visible HOT 6
- Add support to manage gap between placeholder label and entered text. HOT 4
- Unable to display the placeholder above the text field HOT 3
- Animated Placeholder inset issue when used left view HOT 1
- can we hide info view on click of outside of active textfield HOT 1
- For iOS 16 textfield Long press HOT 1
- really good
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tweetextfield.