Skip to content

Commit

Permalink
Remove data source assert. Add warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
seland committed Apr 29, 2016
1 parent 7b2aa0a commit d79a95e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,10 @@ - (void)setCurrentState:(NSInteger)currentState {
[self setCurrentState:currentState animated:NO];
}
- (void)setCurrentState:(NSInteger)currentState animated:(BOOL)animated {
if (!self.dataSource) {
NSLog(@"Warning! Data source of segmented control:%@ wasn't setted. In order to use segmented control set its data source.",self);
return ;
}
NSAssert(currentState < self.statesCount && currentState >= 0, @"Unable to set state %li. Segmented control has only %li states from 0 to %li.",(long)currentState, (long)self.statesCount, (long)(self.statesCount-1));
if (!animated) {
_currentState = currentState;
Expand Down

0 comments on commit d79a95e

Please sign in to comment.