티스토리 뷰

반응형

UIModalPresentationStyle 에 따른 뷰컨트롤러 라이프 사이클(또는 생명주기 또는 상태 변화) / 접근성에 대한 실험 글입니다. 

 

초록색 뷰컨트롤러에서 오렌지색 뷰컨트롤러를 present할 때

초록색 뷰컨트롤러의 상태변화 및 접근성을 살펴봅니다. 

(오렌지색은 opacity를 50%로 줬습니다.) 

 

 


Part 1. 뷰컨트롤러 상태 변화 

 

[1] fullScreen

 

- A presentation style in which the presented view covers the screen.

 

- The views belonging to the presenting view controller are removed after the presentation completes.

 

 

 

== 초록색 뷰컨트롤러 상태 변화 == 

 

오렌지색 뷰컨을 present할 때

viewWillDisappear(_:)

viewDidDisappear(_:)

 

닫기 누를 때

viewWillAppear(_:)

viewDidAppear(_:)

 

 

[2] overFullScreen

 

- A view presentation style in which the presented view covers the screen.

 

- The views beneath the presented content are not removed from the view hierarchy when the presentation finishes.

 

 

 

 

== 초록색 뷰컨트롤러 상태 변화 == 

오렌지색 뷰컨을 present할 때

X


닫기 누를 때
X

 

 

[3] currentContext

 

- the current view controller's content is displayed over the view controller whose definesPresentationContext property is true. UIKit may walk up the view controller hierarchy to find a view controller that wants to define the presentation context. 

 

- The views belonging to the presenting view controller are removed after the presentation completes.

 

 

 

== 초록색 뷰컨트롤러 상태 변화 ==

 

오렌지색 뷰컨을 present할 때

viewWillDisappear(_:)

viewDidDisappear(_:)

 

닫기 누를 때

viewWillAppear(_:)

viewDidAppear(_:)

 

 

[4] overCurrentContext 

 

- the current view controller's content is displayed over the view controller whose definesPresentationContext property is true. UIKit may walk up the view controller hierarchy to find a view controller that wants to define the presentation context. 

 

- The views beneath the presented content are not removed from the view hierarchy when the presentation finishes.

 

 

 

== 초록색 뷰컨트롤러 상태 변화 == 

오렌지색 뷰컨을 present할 때

X


닫기 누를 때
X

 

 

[5] pageSheet

 

- A presentation style that partially covers the underlying content.

 

- A part of the background content always remains visible. 

 

 

[6] formSheet 

 

- A presentation style that displays the content centered in the screen.

To provide a custom content size, use the modal view controller’s preferredContentSize property.

 

- A part of the background content always remains visible.

 

 

[7] popover

- A presentation style where the content is displayed in a popover view.

 

- The background content is dimmed...  (문서에는 안적혀있지만 remain visible)

 

 

pageSheet, formSheet, popover 모두  

 

 

 

== 초록색 뷰컨트롤러 상태 변화 == 

오렌지색 뷰컨을 present할 때

X


닫기 누를 때
X

 

 

 

⚠️ 저는 아이폰 세로모드일 때만 테스트 해봤습니다. 문서 보면 horizontal and vertical size classes 랑 iOS 버전에 따라 displayed 되는게 다르다고 나와있으니 참고해주세요! ⚠️

 

 

 


Part2. 접근성 

 

[1] fullScreen, overFullScreen, concurrentContext, overConcurrentContext

 

아래 깔린 화면의 요소들은 접근성 요소들로 안잡힙니다. 

아래 깔린 화면이 view hierarcy에서 없어지던 안없어지던 보이스오버가 오직 닫기만 읽어주는 것을 볼 수 있습니다. 

 

 

 

[2] pageSheet, formSheet, popover

 

# iOS

마찬가지로 아래 깔린 화면의 요소들은 접근성 요소들로 안잡힙니다. 

 

 

# 아이패드 

 

마찬가지로 아래 깔린 화면의 요소들은 접근성 요소들로 안잡힙니다. 

preferredContentSize 를 작은 사이즈로 설정해주고 formSheet으로 열어봐도

밑의 요소들이 안집히고 닫기 만 접근성요소로 잡히는 것을 볼 수 있습니다. 

 

 

 

그리고 아이패드 가로 모드에서 pageSheet으로 열면 이 부분도 잡히는데, 

보이스오버가 "double tap to dismiss popup window, button" 이라고 읽어줍니다. 

 

 

아이패드에서 popover를 열려면

popover의 anchor point를 명시해줘야합니다. (명시안해주면 iOS에서는 크래쉬가 안나는데 패드에서는 크래쉬가 나더라구여)

 

그래서 테스트를 안해봤지만 팝오버 밑의 영역은 보이스오버가 안읽어줄 것 같습니다. 

 

https://developer.apple.com/documentation/uikit/windows_and_screens/displaying_transient_content_in_a_popover

 

 

 

[ 추가 ]

 

definesPresentationContext 관련된 실험 / fullScreen이랑 currentContext 에 대한 차이는

이 블로그를 참고해주세요!

 

https://magi82.github.io/ios-modal-presentation-style-01/

 

iOS UIModalPresentationStyle 알아보기(currentContext, FullScreen) - 01 – 마기의 개발 블로그 – 즐겁게 개발

안녕하세요. 마기입니다. 오래간만에 포스팅을 하는거 같습니다. 이번에는 UIModalPresentationStyle 에 대해서 알아보고자 합니다. 다양한 스타일이 있는 만큼 나눠서 포스팅할 예정 입니다. 이번 포

magi82.github.io

 

 

 

 

반응형
댓글