두 가지보기 유형이있는 달력 cocoapod (CVCalendar : https://github.com/CVCalendar/CVCalendar)를 사용하고 있습니다. weekView 및 monthView. 다음 함수는 포드에 필요하며 나는 클래스 확장 내에 있습니다스위프트 : viewWillTransition 내 함수 호출 결과가 사용되지 않습니다.
func presentationMode() -> CalendarMode {
let isPhone: Bool = UIDevice.current.userInterfaceIdiom == .phone
let isLandscape: Bool = UIDevice.current.orientation.isLandscape
if isPhone == true && isLandscape == true {
return.weekView
} else {
return .monthView
}
}
가에 표시되어있는 경우에, 나는 달력은 풍경에 아이폰에 표시되어있는 경우 weekView을 제시하려고, 또는 monthView하고 다른 것. 그때 viewWillTransition에서 함수를 호출 오전 : 나는 presentationMode 경고 '에 대한 호출의 결과'를 얻을 수 위의 코드를 사용하지만
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
self.presentationMode()
}
'는 사용되지 않고 뷰는 아이폰 Lanscape입니다에 weekView 변경되지 않습니다.
먼저 기능을 업데이트하시기 바랍니다. 경고는'presentationMode()'의 반환 값이 무엇이든 할당되지 않았기 때문에'CVCalendar'의'CalendarMode'를 설정해야한다는 것입니다. –