按钮选择与否

- (IBAction)didCheck:(id)sender {  
    if(check.selected)  
    {  
        [check setSelected:NO];  
        [check setImage:[UIImage imageNamed:@"checkbox-pressed.png"] forState:UIControlStateHighlighted];  
        [check setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];  
    }else{  
        [check setSelected:YES];  
        [check setImage:[UIImage imageNamed:@"checkbox-pressed.png"] forState:UIControlStateHighlighted];  
        [check setImage:[UIImage imageNamed:@"checkbox-checked.png"] forState:UIControlStateNormal];  
  
    }  
}


你可能感兴趣的:(按钮选择与否)