2つのビュータイプを持つカレンダーココアポッド(CVCalendar:https://github.com/CVCalendar/CVCalendar)を使用しています。 weekViewとmonthView。次の関数は、ポッドに必要と私はクラス拡張以内にそれを持っている:Swift: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
}
}
私はそれが表示されている場合、カレンダーは風景の中にIPhone、またはmonthViewに表示されている場合weekViewを提示しようとしています他に何か。私はその後、viewWillTransitionで関数を呼び出しています:私はpresentationMode警告「への呼び出しの結果 『を取得する上記のコードを使用ししかし
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
self.presentationMode()
}
は』未使用で、ビューはIPhone LanscapeにweekViewに変更されません。
初の機能を更新してください。警告は、 'presentationMode()'の戻り値が何にも割り当てられていないため、 'CVCalendar'の' CalendarMode'を設定する必要があるためです。 –