Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- uiscrollview
- Refactoring
- UICollectionView
- 리팩토링
- uitableview
- MVVM
- scrollview
- UITextView
- rxswift
- tableView
- 클린 코드
- 리펙토링
- combine
- 스위프트
- Protocol
- collectionview
- Xcode
- SWIFT
- RxCocoa
- Observable
- HIG
- swift documentation
- swiftUI
- Clean Code
- map
- ribs
- Human interface guide
- ios
- clean architecture
- 애니메이션
Archives
- Today
- Total
김종권의 iOS 앱 개발 알아가기
[iOS - swift] textField의 placeholder색깔 변경 방법 본문

Code로 접근 방법
- attributedPlaceholder 속성 사용
extension UITextField {
func setPlaceholder(color: UIColor) {
guard let string = self.placeholder else {
return
}
attributedPlaceholder = NSAttributedString(string: string, attributes: [.foregroundColor: color])
}
}
- 색깔 변경
textField.setPlaceholder(color: .blue)
xib에서 접근 방법
- User Defined Runtime Attributes에서 속성 추가: placeholderLabel.textColor


- 결과

'iOS 응용 (swift)' 카테고리의 다른 글
| [iOS - swift] keychain에 암호화/복호화하여 저장 방법 (SecureEnclave) (0) | 2021.03.12 |
|---|---|
| [iOS - swift] view위에 올라가있는 다른 view들을 하나의 tap gesture로 변경 (2) | 2021.03.09 |
| [iOS - swift] mp4, gif 파일 재생 방법 (애니메이션, AVPlayer, Gifu 프레임워크) (0) | 2021.03.04 |
| [iOS - swift] font 편리하게 사용 방법 (enum) (0) | 2021.03.03 |
| [iOS - swift] attributedText, NSMutableAttributedString (원하는 문자열 속성 지정, 문자열 attributedText 반환) (0) | 2021.03.03 |
Comments
