猎豆优选

LXCalendarWeekView.m 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // LXCalendarWeekView.m
  3. // LXCalendar
  4. //
  5. // Created by chenergou on 2017/11/2.
  6. // Copyright © 2017年 漫漫. All rights reserved.
  7. //
  8. #import "LXCalendarWeekView.h"
  9. #import "UIColor+Expanded.h"
  10. #import "UILabel+LXLabel.h"
  11. #import "UIView+LX_Frame.h"
  12. #import "UIView+FTCornerdious.h"
  13. #import "NSString+NCDate.h"
  14. #define Font(f) [UIFont systemFontOfSize:(f)]
  15. @implementation LXCalendarWeekView
  16. -(instancetype)initWithFrame:(CGRect)frame{
  17. self = [super initWithFrame:frame];
  18. if (self) {
  19. }
  20. return self;
  21. }
  22. -(void)setWeekTitles:(NSArray *)weekTitles{
  23. _weekTitles = weekTitles;
  24. CGFloat width = self.lx_width /weekTitles.count;
  25. for (int i = 0; i< weekTitles.count; i++) {
  26. UILabel *weekLabel =[UILabel LXLabelWithText:weekTitles[i] textColor:[UIColor hexStringToColor:@"7F8FA4"] backgroundColor:[UIColor whiteColor] frame:CGRectMake(i * width, 0, width, self.lx_height) font:Font(14) textAlignment:NSTextAlignmentCenter];
  27. weekLabel.backgroundColor =[UIColor whiteColor];
  28. [self addSubview:weekLabel];
  29. }
  30. }
  31. @end