Определите ваши landscape
и portrait
представления в заголовке, присоедините их в Интерфейсном Разработчике и попробуйте этот код:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeRight))){
self.view = landscape;
}else if(((interfaceOrientation == UIInterfaceOrientationPortrait) ||
(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))){
self.view = portrait;
}
return YES;
}
Это намного проще, чем вычислять новые кадры для каждого объекта впредставление.
Для анимации можно добавить [UIView beginAnimations:@"animation" context:nil];
& [UIView commitAnimations];
для анимации нового представления.