Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability for day view to set custom corner radius #278

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions JTCalendar/Views/JTCalendarDayView.h
Expand Up @@ -24,6 +24,13 @@

@property (nonatomic) BOOL isFromAnotherMonth;

/*!
* If set to YES, the day view will be circular by default.
*
* @default: YES
*/
@property (nonatomic) BOOL isCircle;

/*!
* Must be call if override the class
*/
Expand Down
6 changes: 5 additions & 1 deletion JTCalendar/Views/JTCalendarDayView.m
Expand Up @@ -38,6 +38,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder
- (void)commonInit
{
self.clipsToBounds = YES;
self.isCircle = YES;

_circleRatio = .9;
_dotRatio = 1. / 9.;
Expand Down Expand Up @@ -98,7 +99,10 @@ - (void)layoutSubviews

_circleView.frame = CGRectMake(0, 0, sizeCircle, sizeCircle);
_circleView.center = CGPointMake(self.frame.size.width / 2., self.frame.size.height / 2.);
_circleView.layer.cornerRadius = sizeCircle / 2.;

if (self.isCircle) {
_circleView.layer.cornerRadius = sizeCircle / 2.;
}

_dotView.frame = CGRectMake(0, 0, sizeDot, sizeDot);
_dotView.center = CGPointMake(self.frame.size.width / 2., (self.frame.size.height / 2.) +sizeDot * 2.5);
Expand Down