Ответ 1
Как и в iOS 8, все UIViewControllers наследуют протокол UIContentContainer, один из методов которого - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator
, который вы можете (упрощенно) переопределить следующим образом:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
// Stuff you used to do in willRotateToInterfaceOrientation would go here.
// If you don't need anything special, you can set this block to nil.
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
// Stuff you used to do in didRotateFromInterfaceOrientation would go here.
// If not needed, set to nil.
}];
}
Вы заметите, что нет ничего конкретного в ориентации, которая по дизайну; Вращения просмотра iOS представляют собой, по существу, состав конкретной операции матрицы преобразования (изменение размера изображения из одного аспекта в другой является лишь конкретным случаем операции общего изменения размера, в которой известны заранее заданные размеры источника и цели) и операция матрицы вращения (который обрабатывается ОС).