Как перехватить событие didRotateFromInterfaceOrientation?

Рейтинг: 1Ответов: 1Опубликовано: 01.10.2014
    - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
NSLog(@"-------");}

 - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;}

в TableViewController не попадаю в данный обработчик события. Что сделать?

Ответы

▲ 1

Начиная с iOS 6 метод shouldAutorotateToInterfaceOrientation объявлен устаревшим (deprecated), а за логику работы autorotation отвечают два других — supportedInterfaceOrientations и shouldAutorotate

http://habrahabr.ru/post/155969/

upd. мне чтобы дать комментарий не хватает понимания ситуации. вот код который у меня работает в рутконтроллере (надо также в target проекта выставить галочки для device orientation, это вы думаю знаете)

-(BOOL)shouldAutorotate
{
NSLog(@"shouldAutorotate log");
return TRUE;
}

-(NSUInteger)supportedInterfaceOrientations
{
NSLog(@"supportedInterfaceOrientations log");

// return UIInterfaceOrientationMaskAll; или по каждому положению устройства

return  UIInterfaceOrientationMaskPortrait |
        UIInterfaceOrientationMaskPortraitUpsideDown |
        UIInterfaceOrientationMaskLandscapeLeft |
        UIInterfaceOrientationMaskLandscapeRight;

}

при запуске приложения и тот и тот лог должны быть