2014-10-01 15 views
6

Witam Mam problem z obracaniem się Modala przedstawionego ViewController w iOS8. Wszystko to działa dobrze na iOS7 i niższe.iOS8 Modal ViewController Problem z obracaniem

Struct App:

  • RootController (obsługiwane Orientacja: Pionowa)
  • Modal Prezentowane ViewController (obsługiwane Kierunek: Wszystkie)

Mój problem jest kiedy Obróć urządzenie, gdy kontroler modalne jest przedstawiony widok kontrolera Modal nie został zmieniony na ramkę lanscape.

wygląda tak:

enter image description here Metody obrotowe nazwano a gdy ustawienie ramki w celu krajobrazu ręcznie interakcji użytkownika z prawej strony (sito szara) nie działa.

kod RootController:

kod
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationPortrait; 
} 

- (NSUInteger) supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskPortrait; 
} 

Modal Kontroler:

- (NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskAll; 
} 


- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
             duration:(NSTimeInterval)duration 
{ 
    if (self.presentingViewController != nil) { 
     [self.presentingViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation 
                     duration:duration]; 
    } 
} 

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
           duration:(NSTimeInterval)duration 
{ 
    if (self.presentingViewController != nil) { 
     [self.presentingViewController willRotateToInterfaceOrientation:toInterfaceOrientation 
                   duration:duration]; 
    } 
} 

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
    if (self.presentingViewController != nil) { 
     [self.presentingViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; 
    } 
} 

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator 
{ 
    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; 

    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { 

    } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) { 

    }]; 
} 

Może ktoś mi pomóc rozwiązać ten problem dla systemów iOS 8.

+1

Czy ustawiłeś automatyczne maskowanie na swoich elementach interfejsu użytkownika? – Jasper

Odpowiedz

1

W jaki sposób przedstawiasz kontroler widoku modalnego? Dlaczego sam przekazujesz metody rotacji? Po wykonaniu tego należy to zrobić automatycznie, a wszystko, czego potrzebujesz, to metody -supportedInterfaceOrientations (a jak zauważa Jasper, ograniczenia autoreisingu lub automatycznego układu, muszą być poprawne).

Powiązane problemy