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

  • How Things Are Made

    How Things A

    17 HAZİRAN 2008
  • Manuel Vizcaino

    Manuel Vizca

    27 Mayıs 2008
  • SoundHound

    SoundHound

    8 Mart 2006