Skip to content

Commit

Permalink
Merge pull request #7 from selim1377/fix/checkWithoutEvent
Browse files Browse the repository at this point in the history
Now checkbox can change its UI state and delegate notification is opt…
  • Loading branch information
rizumita committed Oct 25, 2015
2 parents 5648f49 + f20a465 commit 804193c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CTCheckbox/CTCheckbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@

- (void)setBackgroundColor:(UIColor *)backgroundColor forControlState:(UIControlState)state;

-(void)setChecked:(BOOL)checked withEvent:(BOOL)withEvent;

@end
11 changes: 8 additions & 3 deletions CTCheckbox/CTCheckbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,17 @@ - (void)changeBackgroundColorForState:(UIControlState)state
}

- (void)setChecked:(BOOL)checked
{
[self setChecked:checked withEvent:YES];
}
-(void)setChecked:(BOOL)checked withEvent:(BOOL)withEvent
{
_checked = checked;

[self setNeedsDisplay];

[self sendActionsForControlEvents:UIControlEventValueChanged];

if(withEvent)
[self sendActionsForControlEvents:UIControlEventValueChanged];
}

- (void)setCheckboxColor:(UIColor *)checkboxColor
Expand Down

0 comments on commit 804193c

Please sign in to comment.