Objective-c中判断某对象是否为某个类的实例

Objective-c中判断某对象是否为某个类的实例


- (IBAction)changeSpeed:(id)sender {
    //判断sender是不是UISlider
    if ([sender isMemberOfClass:[UISlider class]]) {
        speedStepper.value=speedSlider.value;
    }else{
        speedSlider.value=speedStepper.value;
        
    }
    speed.text=[NSString stringWithFormat:@"%f",speedSlider.value ];
}

© 2012, 冰冻鱼. 请尊重作者劳动成果,复制转载保留本站链接! 应用开发笔记