[iOS] UITextView 공식문서 정리

김상우·2022년 1월 28일
0

공식 문서 : https://developer.apple.com/documentation/uikit/uitextview


Declaration

  • UITextView 는 UIScrollView 를 상속하고
  • UITextField 는 UIControl 을 상속한다.

Managing the Keyboard

When the user taps in an editable text view, that text view becomes the first responder and automatically asks the system to display the associated keyboard.

텍스트 뷰를 처음 누르면, text view 는 "First Responder" 가 되고 자동으로 시스템이 키보드를 띄워준다.

Because the appearance of the keyboard has the potential to obscure portions of your user interface, it is up to you to make sure that does not happen by repositioning any views that might be obscured.

키보드가 띄워지면 일부 UI 를 가릴 수 있기 때문에, 그걸 알맞게 처리하는 건 개발자의 몫이다.

It is your application’s responsibility to dismiss the keyboard at the time of your choosing.

그리고 키보드를 띄워주는건 자동이지만 할일을 마치고 띄웠던 키보드를 내리는 것은 코드로 명시해야한다.

To dismiss the keyboard, send the resignFirstResponder() message to the text view that is currently the first responder.

키보드 내리기는 resignFirstResponder() 를 사용한다. resignFirstResponder : https://developer.apple.com/documentation/uikit/uiresponder/1621097-resignfirstresponder

Notifies this object that it has been asked to relinquish its status as first responder in its window.

resignFirstResponder 은 그 객체가 "First Responder" 이기를 해제해주는것

The appearance of the keyboard itself can be customized using the properties provided by the UITextInputTraits protocol.

키보드 커스텀은 UITexttInputTraits 프로토콜로 할 수 있다.


Keyboard Notifications

When the system shows or hides the keyboard, it posts several keyboard notifications.

시스템은 키보드를 표시하거나 숨길 때 여러 키보드 알림을 게시한다.

These notifications contain information about the keyboard, including its size, which you can use for calculations that involve repositioning or resizing views.

이러한 알림에는 보기 위치 변경 또는 크기 조정과 관련된 계산에 사용할 수 있는 크기를 포함하여 키보드에 대한 정보가 포함된다.

이 알림들에 대한 자세한 설명은 UIWindow 에서 볼 수 있다.
UIWindow 공식문서 : https://developer.apple.com/documentation/uikit/uiwindow


inputAccessoryView

공식 문서 : https://developer.apple.com/documentation/uikit/uiresponder/1621119-inputaccessoryview

This property is typically used to attach an accessory view to the system-supplied keyboard that is presented for UITextField and UITextView objects.

일반적으로 UITextField, UITextView 객체에서 표시되는 시스템 키보드에 액세서리 뷰를 붙이는데 사용된다.

profile
안녕하세요, iOS 와 알고리즘에 대한 글을 씁니다.

0개의 댓글