CALayer+Category.m 545 B

12345678910111213141516171819202122
  1. //
  2. // CALayer+Category.m
  3. // CustomCodeInput
  4. //
  5. // Created by WangXueqi on 2018/5/7.
  6. // Copyright © 2018年 JingBei. All rights reserved.
  7. //
  8. #import "CALayer+Category.h"
  9. @implementation CALayer (Category)
  10. + (CALayer *)addSubLayerWithFrame:(CGRect)frame
  11. backgroundColor:(UIColor *)color
  12. backView:(UIView *)baseView
  13. {
  14. CALayer * layer = [[CALayer alloc]init];
  15. layer.frame = frame;
  16. layer.backgroundColor = [color CGColor];
  17. [baseView.layer addSublayer:layer];
  18. return layer;
  19. }
  20. @end