Tweak phone input fields layout more

This commit is contained in:
Ilya Laktyushin 2020-08-26 00:18:46 +03:00
parent 0549a2cba8
commit 8bb519216b
2 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@ import PhoneInputNode
import CountrySelectionUI
private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
return generateImage(CGSize(width: 59, height: 44.0 + 6.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 56, height: 44.0 + 6.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 6.0
let lineWidth = UIScreenPixel
@ -37,11 +37,11 @@ private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColo
context.move(to: CGPoint(x: 0.0, y: lineWidth / 2.0))
context.addLine(to: CGPoint(x: size.width, y: lineWidth / 2.0))
context.strokePath()
})?.stretchableImage(withLeftCapWidth: 58, topCapHeight: 1)
})?.stretchableImage(withLeftCapWidth: 55, topCapHeight: 1)
}
private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIImage? {
return generateImage(CGSize(width: 59.0, height: 44.0 + 6.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 56.0, height: 44.0 + 6.0), rotatedContext: { size, context in
let arrowSize: CGFloat = 6.0
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(color.cgColor)
@ -52,7 +52,7 @@ private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIIma
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize))
context.closePath()
context.fillPath()
})?.stretchableImage(withLeftCapWidth: 58, topCapHeight: 2)
})?.stretchableImage(withLeftCapWidth: 55, topCapHeight: 2)
}
private func generatePhoneInputBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
@ -261,9 +261,9 @@ final class ChangePhoneNumberControllerNode: ASDisplayNode {
transition.updateFrame(node: self.countryButton, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight), size: CGSize(width: layout.size.width, height: 44.0 + 6.0)))
transition.updateFrame(node: self.phoneBackground, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight + 44.0), size: CGSize(width: layout.size.width, height: 44.0)))
let countryCodeFrame = CGRect(origin: CGPoint(x: 9.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 67.0, height: 44.0))
let countryCodeFrame = CGRect(origin: CGPoint(x: 11.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 67.0, height: 44.0))
let numberFrame = CGRect(origin: CGPoint(x: 92.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: layout.size.width - 70.0 - 8.0, height: 44.0))
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 8.0)
let placeholderFrame = numberFrame.offsetBy(dx: 0.0, dy: 8.0)
let phoneInputFrame = countryCodeFrame.union(numberFrame)

View File

@ -192,7 +192,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
let countryCodeFrame = CGRect(origin: CGPoint(x: 18.0, y: size.height - 57.0), size: CGSize(width: 71.0, height: 57.0))
let numberFrame = CGRect(origin: CGPoint(x: 107.0, y: size.height - 57.0), size: CGSize(width: size.width - 96.0 - 8.0, height: 57.0))
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 16.0)
let placeholderFrame = numberFrame.offsetBy(dx: 0.0, dy: 16.0)
let phoneInputFrame = countryCodeFrame.union(numberFrame)