SORU
28 EKİM 2013, PAZARTESİ


o'in Olay ValueChanged iOS7 UİSwitch: sürekli bu Hata arayarak ya da ne..?

Edit

Şimdi tamir
Bunu düzeltmek için herhangi bir tweak yapma.

Edit2

Görünüşe göre aynı sorunu tekrar iOS 8.0 ve 8.1 olur


Merhaba Bugün gördüm UISwitch's Olay ValueChanged: Arama continuously iken ben değiştirmek için On Off Off ve benim parmak taşındı hala sağ tarafı ile sol tarafı. NSLog ile daha net GİF ben atteched.

enter image description here

Benim Değer Yöntemi Değişti:-

- (IBAction)changeSwitch:(id)sender{

    if([sender isOn]){
        NSLog(@"Switch is ON");
    } else{
        NSLog(@"Switch is OFF");
    }

}

Anahtarı aynı kod Sorun olarak çalışmaya beklenti: - iOS6

enter image description here

kimse bana tavsiye sadece bir kez Ara ya da kapalı durumda. ya da bu bir hata ya da ne..?

GÜNCELLEME

İşte benim Demo:-

programmatic Add UISwitch

from XIB adding UISwitch

CEVAP
28 EKİM 2013, PAZARTESİ


Aşağıda kodlama bakın lütfen

    - (void)viewDidLoad
{
      [super viewDidLoad];    
      UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(130, 235, 0, 0)];    
    [mySwitch addTarget:self action:@selector(changeSwitch:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:mySwitch];
}

- (void)changeSwitch:(id)sender{
    if([sender isOn]){
        NSLog(@"Switch is ON");
    } else{
        NSLog(@"Switch is OFF");
    }
}

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • LatinNinja99

    LatinNinja99

    28 EKİM 2011
  • Māris Zaharovs

    Māris Zahar

    28 Mayıs 2008
  • Visual Life

    Visual Life

    3 Temmuz 2006