Неявное преобразование из типа перечисления «UIInterfaceOrientation» в другой тип перечисления «UIDeviceOrientation» - PullRequest
2 голосов
/ 07 декабря 2011

Я получаю вышеупомянутое предупреждение компилятора для кода ниже.Я понимаю разницу между интерфейсом и ориентацией устройства, но не знаю, как внести изменения, чтобы удалить предупреждение.Кто-нибудь может помочь?

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (ViewController != NULL) {
    [ViewController configureForDeviceOrientation:toInterfaceOrientation];
}
if (Controller != NULL) {
    [Controller configureForDeviceOrientation:toInterfaceOrientation];
}
currentOrientation = toInterfaceOrientation;
}

Ответы [ 2 ]

6 голосов
/ 07 декабря 2011

просто разыграйте [Controller configureForDeviceOrientation:(UIDeviceOrientation)toInterfaceOrientation];

2 голосов
/ 07 декабря 2011

Ваш метод configureForDeviceOrientation: ожидает, что ему будет передано перечисление UIDeviceOrientation, а не UIInterfaceOrientation, которое вы передаете.

Если вы исправите свой метод, чтобы принять UIInterfaceOrientation из метода willRotateToInterfaceOrientation:, то вы решите проблему.

...