Skip to content

Commit

Permalink
Fix selector background if not provided, and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nighthawk committed Jul 31, 2020
1 parent 689af44 commit ffee2b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions Classes/ASDaySelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ - (void)drawRect:(CGRect)rect
CGContextSetStrokeColorWithColor(context, self.circleColor.CGColor);
CGContextStrokeEllipseInRect(context, circleRect);
}

}

#pragma mark - Private helpers
Expand Down
21 changes: 14 additions & 7 deletions Classes/ASWeekSelectorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ - (void)setSelectedDate:(NSDate *)selectedDate animated:(BOOL)animated
completion:
^(BOOL finished) {
self.isAnimating = NO;
[self colorLabelForDate:selectedDate withTextColor:self.selectorLetterTextColor];
if (finished) {
[self colorLabelForDate:selectedDate withTextColor:self.selectorLetterTextColor];
}
}];
}
}
Expand All @@ -95,7 +97,8 @@ - (void)setLocale:(NSLocale *)locale
[self updateDateFormatters];
}

- (void)refresh {
- (void)refresh
{
[self rebuildWeeks];
}

Expand Down Expand Up @@ -181,7 +184,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
}

// prevent horizontal scrolling
if (offset.y != 0) {
if (fabs(offset.y) > 0.01) {
offset.y = 0;
updatedOffset = YES;
}
Expand Down Expand Up @@ -342,7 +345,9 @@ - (void)singleWeekView:(ASSingleWeekView *)singleWeekView didSelectDate:(NSDate
}
completion:
^(BOOL finished) {
[self userDidSelectDate:date];
if (finished) {
[self userDidSelectDate:date];
}
}];
}

Expand Down Expand Up @@ -425,7 +430,7 @@ - (void)rebuildWeeks

// determine where the start of the previews week was as that'll be our start date
NSDateComponents *component = [self.gregorian components:NSCalendarUnitWeekday fromDate:self.selectedDate];
NSInteger weekday = [component weekday];
NSUInteger weekday = (NSUInteger) [component weekday];
NSInteger daysToSubtract;
if (weekday == self.firstWeekday) {
daysToSubtract = 0;
Expand Down Expand Up @@ -513,7 +518,9 @@ - (void)animateSelectionToPreDrag
^{
self.selectionView.frame = selectionViewFrame;
} completion:^(BOOL finished) {
[self colorLabelForDate:self.selectedDate withTextColor:self.selectorLetterTextColor];
if (finished) {
[self colorLabelForDate:self.selectedDate withTextColor:self.selectorLetterTextColor];
}
}];

self.preDragOffsetX = MAXFLOAT;
Expand Down Expand Up @@ -557,7 +564,7 @@ - (ASDaySelectionView *)selectionView
CGFloat height = CGRectGetHeight(self.frame);

ASDaySelectionView *view = [[ASDaySelectionView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
view.backgroundColor = self.selectorBackgroundColor;
view.backgroundColor = self.selectorBackgroundColor ?: [UIColor clearColor];
view.fillCircle = YES;
view.circleCenter = CGPointMake(width / 2, 20 + (height - 20) / 2);
view.circleColor = self.tintColor;
Expand Down

0 comments on commit ffee2b1

Please sign in to comment.