SORU
11 AĞUSTOS 2014, PAZARTESİ


8 Döndürme Yöntemleri Admin - Geriye Uyumluluk iOS

İOS 8, arayüzü rotasyonu için yöntemleri vardır deprecated. Bu içerir:

  • willRotateToInterfaceOrientation:duration:
  • didRotateFromInterfaceOrientation:
  • willAnimateRotationToInterfaceOrientation:duration:

Değiştirme yöntemleri vardır:

  • willTransitionToTraitCollection:withTransitionCoordinator:
  • viewWillTransitionToSize:withTransitionCoordinator:

Yeni rotasyon yöntemleri uygulanmadı ve bir proje iOS 8 SDK, görünüm denetleyicileri -. ile derlendi ^strong>aramalar alırsınız- itiraz döndürme yöntemleri.

Benim sorunum şu:Zaten Android iOS 7 SDK ile inşa edilen bir uygulama ne olacak? İtiraz döndürme yöntemleri hala 8 Cihaz ya da değil, bir iOS çağrılır?

DÜZENLEME:

Rotasyon yöntemleri hala denir, ama iOS 8'de/böcek sorunları/bazı değişiklikler var.

Ayrıca UIScreen is now interface oriented

CEVAP
1 EKİM 2014, ÇARŞAMBA


Ben sadece bu sorunu vardı ve daha önce kullanıyordum aynı yöntemleri kullanmak istedim (en azından şimdilik), bu ne yaptım.

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

    //The device has already rotated, that's why this method is being called.
    UIInterfaceOrientation toOrientation   = [[UIDevice currentDevice] orientation];
    //fixes orientation mismatch (between UIDeviceOrientation and UIInterfaceOrientation)
    if (toOrientation == UIInterfaceOrientationLandscapeRight) toOrientation = UIInterfaceOrientationLandscapeLeft;
    else if (toOrientation == UIInterfaceOrientationLandscapeLeft) toOrientation = UIInterfaceOrientationLandscapeRight;

    UIInterfaceOrientation fromOrientation = [[UIApplication sharedApplication] statusBarOrientation];

    [self willRotateToInterfaceOrientation:toOrientation duration:0.0];
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
        [self willAnimateRotationToInterfaceOrientation:toOrientation duration:[context transitionDuration]];
    } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
        [self didRotateFromInterfaceOrientation:fromOrientation];
    }];

}

Eğer hala süresi olmadığı için animasyon Bu blok dışında kullanmam gerektiğinden emin değilim.

    [self willRotateToInterfaceOrientation:toOrientation duration:0.0];

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Ammine Getahun

    Ammine Getah

    21 HAZİRAN 2011
  • ethr95awd

    ethr95awd

    8 Kasım 2006
  • spyib

    spyib

    9 Ocak 2007