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

  • jeffisthecoolguy

    jeffisthecoo

    17 HAZİRAN 2013
  • LavcoPriceTech

    LavcoPriceTe

    21 AĞUSTOS 2010
  • lilstevie89

    lilstevie89

    25 Mart 2011