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

  • The Onion

    The Onion

    14 Mart 2006
  • The White House

    The White Ho

    21 Ocak 2006
  • The10HourMan

    The10HourMan

    28 EYLÜL 2012