mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Phone number change improvements
This commit is contained in:
parent
a73a704910
commit
c2f42f03e5
12 changed files with 452 additions and 422 deletions
|
|
@ -165,6 +165,7 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
private var didSetupPlaceholder = false
|
||||
private func updatePlaceholder() {
|
||||
if let mask = self.mask {
|
||||
let mutableMask = NSMutableAttributedString(attributedString: mask)
|
||||
|
|
@ -178,7 +179,10 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
|
|||
} else {
|
||||
self.placeholderNode.attributedText = NSAttributedString(string: "")
|
||||
}
|
||||
let _ = self.placeholderNode.updateLayout(CGSize(width: self.frame.size.width, height: CGFloat.greatestFiniteMagnitude))
|
||||
if !self.frame.size.width.isZero {
|
||||
self.didSetupPlaceholder = true
|
||||
let _ = self.placeholderNode.updateLayout(CGSize(width: self.frame.size.width, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
}
|
||||
|
||||
private let fontSize: CGFloat
|
||||
|
|
@ -352,4 +356,12 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
|
|||
|
||||
self.updatePlaceholder()
|
||||
}
|
||||
|
||||
public override func layout() {
|
||||
super.layout()
|
||||
|
||||
if !self.didSetupPlaceholder, self.frame.width > 0.0 {
|
||||
self.updatePlaceholder()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue