관리 메뉴

김종권의 iOS 앱 개발 알아가기

[iOS - swift] UITextView에 Placeholder 추가 (STTextView 프레임워크) 본문

iOS 응용 (swift)

[iOS - swift] UITextView에 Placeholder 추가 (STTextView 프레임워크)

jake-kim 2021. 2. 3. 23:21

UITextView

  • UITextField는 UI가 한 줄이지만 UITextView는 "TextArea"개념 (넓은 면적)
  • UITextView는 placeholder를 제공하지 않음
  • placeholder를 구현하려고 하면, 입력 시 한글 자모가 불리되는 현상 발생 

STTextView 프레임워크

  • placeholder가 구현된 프레임워크
  • 의존성
pod 'STTextView'

사용

  • UITextView 추가

 

  • class - STTextView로 설정

  • placeholder에 입력 (font는 text와 동일한 font를 갖음)

  • cursor 색 설정 - tint color

* 참고: github.com/onl1ner/STTextView

Comments