Closed NEULiee closed 2 years ago
Create Sections for an Editing Mode
Configure the View and Editing Modes
Add an Edit Button
editButtonItem
propertysetEditing(_:animated:)
Show Headers in Editing Mode
Quiz.1 Which of the following is NOT true about headers in a UICollectionView?
커스텀 Content View
UIContentConfiguration
didSet
modern content view
iOS14 부터 tableView, collectionView 에서 content configuration 를 사용해서 내용을 표시하는 것을 modern cell configuration이라고 하는 것 같다.
Extract Configuration Methods ( cell 구성을 분리한다 )
Create a Reusable Layout Function
Create a Custom View with a Text Field
Conform to the Content View Protocol
Complete the Content View
Display the Content View
Create Content Views for the Date and Notes
Q. What would you NOT include in a custom content view? A. A reference to the model data Including model data directly in the view code can create problems. Instead, provide the content view with a configuration structure with a property that includes the model data. 뷰 코드에 직접 모델 데이터를 포함하면 문제가 발생할 수 있으니 모델 데이터를 포함하는 속성이 있는 구성 구조와 함께 콘텐츠 보기를 제공
Q. Which code snippet defines and activates the height constraint for subview?
A. subview.heightAnchor.constraint(equalToConstant: 120).isActive = true
Q. How can you ensure your content view’s visual representation stays in sync with its associated model data?
A. Include a didSet
observer for the configuration property in your content view that reconfigures the view every time the configuration object changes.
didSet observer를 포함
Add a Working Reminder
Make the Text Configuration Editable
var onChange: (String)->Void = { _ in }
Make the Date Configuration Editable
Make the Notes Configuration Editable
Cancel Edits
Observe Changes in a View Hierarchy
Q. Which of the following is NOT a reason why UIKit uses the delegate pattern for many controls? UIKit 에서 delegate 패턴을 사용하는 이유중 옳지 않은 것은?
A. It allows you to tightly couple the view controls to the model. The opposite is true. A UIKit control that uses the delegate pattern doesn’t need to know anything about the model. A control reports to their delegate only that an interaction or event has occurred. The delegate is responsible for responding accordingly.
Q. What step is missing from this process for setting up a custom date picker content view?
A. Register a target and an action with the picker. date picker에 addTarget 으로 action을 추가한다.
Getting Ready for Editing