Comments (2)
private var placeHolderOrginal = CGRect() //INITIALIZE
override open func drawViewsForRect(_ rect: CGRect) {
let frame = CGRect(origin: CGPoint.zero, size: CGSize(width: rect.size.width, height: rect.size.height))
placeholderLabel.frame = frame.insetBy(dx: placeholderInsets.x, dy: placeholderInsets.y)
placeholderLabel.font = placeholderFontFromFont(font!)
updateBorder()
updatePlaceholder()
placeHolderOrginal = placeholderLabel.frame // ADDED THIS LINE
layer.addSublayer(inactiveBorderLayer)
layer.addSublayer(activeBorderLayer)
addSubview(placeholderLabel)
}
override open func animateViewsForTextEntry() {
if text!.isEmpty {
UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 1.0, options: .beginFromCurrentState, animations: ({
self.placeholderLabel.frame.origin = CGPoint(x: 10, y: self.placeHolderOrginal.origin.y) //UPDATED THIS
self.placeholderLabel.alpha = 0
}), completion: { _ in
self.animationCompletionHandler?(.textEntry)
})
}
layoutPlaceholderInTextRect()
//ADDED BELOW CONDITION
if !(text!.isEmpty) {
placeholderLabel.frame.origin = activePlaceholderPoint
}
UIView.animate(withDuration: 0.4, animations: {
self.placeholderLabel.alpha = 1.0
})
activeBorderLayer.frame = rectForBorder(borderThickness.active, isFilled: true)
}
This is just a raw patch.
Resolved My issue
from textfieldeffects.
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.
from textfieldeffects.
Related Issues (20)
- Place holder font is different than the standard font HOT 11
- Change Placeholder to attributed font HOT 9
- Clear-Button is not being displayed HOT 1
- Hoshi Placeholder wrongly placed when Textfield is firstResponder HOT 14
- Font types of placeholder and content don't match HOT 4
- Placeholder label text not changing HOT 11
- Module compiled with Swift 5.1.2 cannot be imported by the Swift 5.2 compiler HOT 5
- HoshiTextField inactive state line does not appear HOT 3
- Issue in KaedeTextField Effect. HOT 1
- Use of .fontName deprecated in Xcode 11 HOT 3
- It is not working on black background for view and white background for textfield HOT 1
- ailed to set (borderActiveColor) user defined inspected property on (TextFieldEffects.YokoTextField) this class is not key value coding-compliant for the key borderActiveColor. HOT 1
- TextField overlap rightview HOT 2
- How to move placeholder to center and stays there when cursor is ready
- Round Corner on Akira HOT 2
- Issue with some Fonts
- Issue with placeholder in iOS 15
- placeholder. floating not working proper
- Privacy Manifest
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 textfieldeffects.