iOS/iOS SeSAC 2기 TIL

iOS UITextField 에 대한 UI 속성 + 추가 액션

Developer-Michelle 2022. 7. 6. 15:33

 UITextField에 대한 UI 속성

https://developer.apple.com/documentation/uikit/uitextfield/1619643-textalignment

 

Apple Developer Documentation

 

developer.apple.com

placeholder : ~를 입력하라고 안내해주는 안내문구 

placeholder에 쓰는 글씨 색상 변경:

사용예시 >>

emailtxtField.attributedPlaceholder = NSAttributedString(string: "이메일 주소 또는 전화번호", attributes: [NSAttributedString.Key.foregroundColor : UIColor.lightGray])

 

isSecureTextEntry : 비밀번호 입력시 ***** 로 뜨면서 정보보호

 

borderStyle : .roundRect, .bezel, .line, .none

https://boidevelop.tistory.com/62

 

textColor: 사용자가 무언가를 텍스트필드에 새롭게 입력할 때 여기에 입력하는 색깔로 나타난다.

 

keyboardType

 

textAlignment

 

backgroundColor: textField 전체를 채우는 배경 색깔 변경.

 

 

*UITextfield 관련하여 구현 가능한 한줄짜리 코드:

문자에 인증번호 와서 앱 위에 키보드에 자동완성쪽에 뜨는거 누르면 바로 입력되는거.

numberTextField.textContentType = .oneTimeCode