WillDoCell.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // WillDoCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/19.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WillDoCell.h"
  9. @implementation WillDoCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. _markNumLabel.backgroundColor = [UIColor redColor];
  13. _markNumLabel.layer.masksToBounds = YES;
  14. _markNumLabel.layer.cornerRadius = _markNumLabel.frame.size.height/2.0;
  15. }
  16. -(void)setImageName:(NSString *)imageName{
  17. UIImage *image = [UIImage imageNamed:imageName];
  18. // 1> 生成文本附件
  19. NSTextAttachment *textAttach = [[NSTextAttachment alloc] init];
  20. textAttach.image = image;
  21. textAttach.bounds = CGRectMake(0, 0, _shortTitleLabel.frame.size.width, _shortTitleLabel.frame.size.height);
  22. // 2> 使用文本附件创建属性文本
  23. NSAttributedString *strA = [NSAttributedString attributedStringWithAttachment:textAttach];
  24. _shortTitleLabel.attributedText = strA;
  25. }
  26. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  27. [super setSelected:selected animated:animated];
  28. // Configure the view for the selected state
  29. }
  30. @end