티스토리 뷰

반응형

[1] Consider size & size class instead of orientation

 

portrait모드일때는 왼쪽 레이아웃,

landscape모드일때는 오른쪽 레이아웃으로 나오게 해놨다고 합시다. 

 

 

그럼 아래와 같이 아이패드 landscape 모드에서 split view를 띄우면 

landscape일때의 레이아웃으로 나오겠죠...!!! 노우..!!!

 

 

우리가 원하는 것인 이런 레이아웃 인데 말입니다ㅠㅠ 

 

 

그래서 orientation으로 분기하지 말고

 

 

Bounds 또는 Size Class로 분기하라고 하네요

 

 

 

 

[2] Think about how to respond to transition

 

rotation & resizing 상태에 대해 인지하고 UI를 바꾸고 싶다면 아래의 함수들을 이용할 수 있습니다. 

 

 

관련 메소드들이 아래의 순서로 불린다고 합니다..!!

 

 

 

UI Change를 이런식으로 해줄 수 있겠네요...!

 

 

 

+ 그리고 이 함수를 써보다가 알게 되었는데,

coordinator안의 블럭들에서 self.view.bounds를 출력해보면 newSize이더라구요....!

 

 

[3] split view 또는 slide over일때, traitCollection

 

가로모드일때는 

slide over, split 1/2, split 1/3 일때 

- horizontal: compact

- vertical: regular 

 

split 2/3 , 단일일때

- horizontal: regular

- vertical: regular 

 

입니다.

 

 

 

세로모드일때는 

slide over, split 2/3, split 1/3 일때 

- horizontal: compact

- vertical: regular 

 

단일일때

- horizontal: regular

- vertical: regular 

 

입니다.

 

(세로모드에서 1/2씩 split 하는 것은 안되더라구요...!!) 

 

 

 

[4] UIScreen.main.bounds 을 유의하시오

UIScreen.main.bounds.width 를 많이 쓰는데, 이것은 디바이스 크기인 점을 유의해주세요

멀티태스킹을 고려한다면, 뷰의 크기 또는 윈도우의 크기를 이용하도록 바꿔줘야합니다.

 

ex) self.view.bounds.width 

ex) UIApplication.shared.windows.first 또는 view.window

 

 

[5] collectionView를 썼다면 

 

developer.apple.com/forums/thread/98590

 

UICollectionViewCell & Multita… | Apple Developer Forums

In full screen landscape mode without Multitasking UICollection View Cell Columns are 5, When in landscape mode app goes in to multitasking with regular and regular traitcollection columns should be 3. How to do that?

developer.apple.com

 

Reference

https://developer.apple.com/videos/play/wwdc2015/205/

 

Getting Started with Multitasking on iPad in iOS 9 - WWDC 2015 - Videos - Apple Developer

iOS 9 on iPad introduces the ability to view and interact with more than one app at a time. Discover how to update your code to take...

developer.apple.com

 

https://www.hackingwithswift.com/example-code/uikit/how-to-animate-when-your-size-class-changes-willtransitionto

 

반응형
댓글