以下の内容はhttps://anton0825.hatenablog.com/entry/20140615/1410520742より取得しました。


iOS7でUISwitchをタップし、そのままドラッグすると値が変わってないのにvalue changedイベントが何度も呼ばれる

おそらくiOS7のバグ。
どんな現象かは以下を見るとよくわかる。
ios - iOS7 UISwitch it's Event ValueChanged: Calling continuously is this Bug or what..? - Stack Overflow
解決方法は以下。
Viewのプロパティにvalue changedイベントが呼ばれる前の値を保持しておき、
それと比較して値が変化している場合のみ処理を行う。

@interface CustomView ()
@property (nonatomic) BOOL previousValue;
@end

@implementation CustomView
- (IBAction)valueChangedSwitch:(id)sender
{
    if (self.previousValue != self.switch.on) {
        // 処理
        self.previousValue = self.switch.on;
    }
}
@end



以上の内容はhttps://anton0825.hatenablog.com/entry/20140615/1410520742より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14