let weightTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "Enter weight"
textField.textColor = .white
textField.backgroundColor = #colorLiteral(red: 0.01360723097, green: 0.01638710871, blue: 0.01815891452, alpha: 1)
textField.borderStyle = .roundedRect
// 플레이스홀더 색상 및 폰트 설정
let placeholderAttributes: [NSAttributedString.Key: Any] = [
.foregroundColor: UIColor.darkGray, // 플레이스홀더 색상
.font: UIFont.boldSystemFont(ofSize: 18) // 굵은 폰트
]
textField.attributedPlaceholder = NSAttributedString(string: "Enter weight", attributes: placeholderAttributes)
// 텍스트 필드의 폰트 설정
textField.font = UIFont.boldSystemFont(ofSize: 18)
// 텍스트 중앙 정렬
textField.textAlignment = .center
return textField
}()
플레이스 홀더도 커스텀 할일이 많다 ~
왜냐...텍스트 필드 색상입력창이 색상이 바뀔때마다... 글자가 안보여
아무튼 그래서 기록을 남긴다.
요렇게 하면 텍스트 중앙정렬도 되고 좋다 컬러선택은 #colorLiteral() 이거쓴다~ 원하는 색상 커스텀 할려고
다음에도 잘 이용하자 아자.