SORU
21 EYLÜL 2010, Salı


Nasıl bir UİLabel arka plan rengini canlandırmak için?

Bu çalışması gerekir gibi görünüyor, ama değil. Rengi bir anda yeşile döner.

    self.labelCorrection.backgroundColor = [UIColor whiteColor];
    [UIView animateWithDuration:2.0 animations:^{
        self.labelCorrection.backgroundColor = [UIColor greenColor];
    }];

CEVAP
21 EYLÜL 2010, Salı


Her yerde belgelenmiş bulamıyorum, ama UILabel backgroundColor tesisinde vanilya UIView kodunuzu çalışır gibi animatable, iyi olmadığı anlaşılıyor. Bu hack çalışması için görünür, ancak, etiket arka plan rengini ayarlamak değilsin sürece kendisi görünüm:

#import <QuartzCore/QuartzCore.h>

...

theLabel.layer.backgroundColor = [UIColor whiteColor].CGColor;

[UIView animateWithDuration:2.0 animations:^{
    theLabel.layer.backgroundColor = [UIColor greenColor].CGColor;
} completion:NULL];

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Adam Outler

    Adam Outler

    19 EKİM 2006
  • Emotional Trancer

    Emotional Tr

    4 Mart 2010
  • eurotuner

    eurotuner

    6 Mart 2006