// // DIVCalendarCell.m // FSCalendar // // Created by dingwenchao on 02/11/2016. // Copyright © 2016 wenchaoios. All rights reserved. // #import "DIVCalendarCell.h" #import "FSCalendarExtensions.h" @implementation DIVCalendarCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { UIImageView *circleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"circle"]]; [self.contentView insertSubview:circleImageView atIndex:0]; self.circleImageView = circleImageView; CAShapeLayer *selectionLayer = [[CAShapeLayer alloc] init]; selectionLayer.fillColor = [UIColor blackColor].CGColor; [self.contentView.layer insertSublayer:selectionLayer below:self.titleLabel.layer]; self.selectionLayer = selectionLayer; self.shapeLayer.hidden = YES; self.backgroundView = [[UIView alloc] initWithFrame:self.bounds]; self.backgroundView.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.1]; } return self; } - (void)layoutSubviews { [super layoutSubviews]; self.backgroundView.frame = CGRectInset(self.bounds, 1, 0.5); self.circleImageView.frame = self.backgroundView.frame; self.selectionLayer.frame = CGRectInset(self.bounds, -1, 0); } @end