SORU
22 Mart 2011, Salı


UİView dikey flip animation

UIViewAnimationTransitionFlipFromRight ile bir iOS UİView var. Dikey çevirmek olsa gerek. Sayfa geçiş kesmeyecek kıvırın. Bu da daha özel bir şey gerekir sanırım.

Herhangi bir fikir?

CEVAP
22 Mart 2011, Salı


Sadece flip kullanarak Temel Animasyon Dönüşümleri için kendi yönteminizi yazın.

- (void)verticalFlip{
    [UIView animateWithDuration:someDuration delay:someDelay animations:^{
        yourView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0);
    } completion:^{
        // code to be executed when flip is completed
    }];
}

Çerçeveler eklendi ve dahil/Çekirdek Animasyon kütüphaneleri var ve ayrıca eğer M_PI gösterimde kullanmak istiyorsanız math.h dahil olduğundan emin olun.

DÜZENLEME:

""Yarım zaman görünümü böyle bir şey yapmak çevirdi: . değişiklik var aslında

- (void)verticalFlip{
    [UIView animateWithDuration:someDuration delay:someDelay animations:^{
        yourView.layer.transform = CATransform3DMakeRotation(M_PI_2,1.0,0.0,0.0); //flip halfway
    } completion:^{
        while ([yourView.subviews count] > 0)
            [[yourView.subviews lastObject] removeFromSuperview]; // remove all subviews
        // Add your new views here 
        [UIView animateWithDuration:someDuration delay:someDelay animations:^{
            yourView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0); //finish the flip
        } completion:^{
            // Flip completion code here
        }];
    }];
}

Bu da işe yarayabilir:

- (void)verticalFlip{

    // Do the first half of the flip
    [UIView animateWithDuration:someDuration delay:someDelay animations:^{
        yourView.layer.transform = CATransform3DMakeRotation(M_PI_2,1.0,0.0,0.0); //flip halfway
    } completion:^{
        while ([yourView.subviews count] > 0)
            [[yourView.subviews lastObject] removeFromSuperview]; // remove all subviews
        // Add your new views here 
    }];

    // After a delay equal to the duration delay of the first half of the flip, complete the flip
    [UIView animateWithDuration:someDuration delay:durationOfFirstAnimation animations:^{
        yourView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0); //finish the flip
    } completion:^{
        // Flip completion code here
    }];
}

Şerefe.

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Animation Workshop

    Animation Wo

    8 NİSAN 2010
  • circuschina

    circuschina

    16 Mart 2007
  • FamilyFeud

    FamilyFeud

    22 AĞUSTOS 2006