You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice one thing in this code when I use this textfield in my app PLACEHOLDER ans textfield TEXT are not in centre I want that in centre so I change in this code little bit and change are below
// MARK: Properties
/**
The formatter used before displaying content in the title label.
This can be the `title`, `selectedTitle` or the `errorMessage`.
The default implementation converts the text to uppercase.
*/
open var titleFormatter: ((String) -> String) = { (text: String) -> String in
if #available(iOS 9.0, *) {
return text
} else {
return text
}
}
this one is for not get title lable text in capital
/**
Calculate the rectangle for the textfield when it is being edited
- parameter bounds: The current bounds of the field
- returns: The rectangle that the textfield should render in
*/
override open func editingRect(forBounds bounds: CGRect) -> CGRect {
let superRect = super.editingRect(forBounds: bounds)
let titleHeight = self.titleHeight()
let centerHeight = ((bounds.size.height / 2) / 2) / 2
var height = superRect.size.height - titleHeight - selectedLineHeight
if errorMessagePlacement == .bottom {
height -= errorHeight()
}
let rect = CGRect(
x: superRect.origin.x,
y: centerHeight,
width: superRect.size.width,
height: height
)
return rect
}
/**
Calculate the rectangle for the placeholder
- parameter bounds: The current bounds of the placeholder
- returns: The rectangle that the placeholder should render in
*/
override open func placeholderRect(forBounds bounds: CGRect) -> CGRect {
var height = bounds.size.height - titleHeight() - selectedLineHeight
let centerHeight = ((bounds.size.height / 2) / 2) / 2
if errorMessagePlacement == .bottom {
height -= errorHeight()
}
let rect = CGRect(
x: 0,
y: centerHeight,
width: bounds.size.width,
height: height
)
return rect
}
this code is for make text in centre "centerHeight" this make text and **placeholder** in centre
The text was updated successfully, but these errors were encountered:
I notice one thing in this code when I use this textfield in my app PLACEHOLDER ans textfield TEXT are not in centre I want that in centre so I change in this code little bit and change are below
// MARK: Properties
The text was updated successfully, but these errors were encountered: