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

  • bethliebert

    bethliebert

    23 EKİM 2008
  • How To Cook That

    How To Cook

    16 NİSAN 2011
  • stokelycalm

    stokelycalm

    28 Aralık 2010