2014-10-01 31 views
6

Merhaba IOS8'de sunulan bir Modal sundu ViewController döndürme ile ilgili bir sorunum var. Tüm bu iOS7 ve daha düşük çalışıyor.iOS8 Modal ViewController Döndürme sorunu

Uygulama Planı:

  • RootController (desteklenen Yön: Dikey)
  • Modal ViewController Sunan (desteklenen Oryantasyon: Tümü) Ben Cihazı döndürün zaman

My Problem olduğunda Modal Kontrolörü Modal denetleyicinin görünümünün peyzaj manzarası çerçevesine yeniden boyutlandırılmadığı sunulur.

böylece benziyor:

enter image description here Rotasyon yöntemleri denilen ve el Yatay olarak sağ tarafına (ekran gri tarafı) kullanıcı etkileşimi bakış çerçevesi ayarladığınızda çalışmadı.

RootController kodu:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationPortrait; 
} 

- (NSUInteger) supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskPortrait; 
} 

Modal Denetleyici kodu:

- (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) { 

    }]; 
} 

herhangi bir iOS8 için bu sorunu çözmek için bana yardımcı olabilir.

+1

Mask'in otomatik kullanıcı arayüzünüzde otomatikleştirilmesini ayarladınız mı? – Jasper

cevap

1

Modal görünüm denetleyicisini nasıl sunuyorsunuz? Rotasyon yöntemlerini neden kendiniz yönlendiriyorsunuz? Düzgün yapıldığında, bu otomatik olarak ele alınmalıdır ve ihtiyacınız olan tek şey -supportedInterfaceOrientations yöntemleridir (ve Jasper notları, autoresizingMask veya Auto Layout kısıtlamaları, doğru olması gerekir).