Geen omschrijving

DetailNoCommentCell.m 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // DetailNoCommentCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/9/9.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "DetailNoCommentCell.h"
  9. @interface DetailNoCommentCell ()
  10. @property (nonatomic, strong) UIImageView *imgView;
  11. @property (nonatomic, strong) UILabel *titleLabel;
  12. @end
  13. @implementation DetailNoCommentCell
  14. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  15. {
  16. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  17. if (self) {
  18. [self addAllSubviews];
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. }
  21. return self;
  22. }
  23. - (void)addAllSubviews{
  24. [self.contentView addSubview:self.imgView];
  25. [self.contentView addSubview:self.titleLabel];
  26. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.top.equalTo(self.contentView).offset(33);
  28. make.centerX.equalTo(self.contentView);
  29. }];
  30. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.equalTo(self.imgView.mas_bottom).offset(15);
  32. make.centerX.equalTo(self.contentView);
  33. }];
  34. }
  35. - (UIImageView *)imgView{
  36. if (_imgView == nil) {
  37. _imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sofa"]];
  38. }
  39. return _imgView;
  40. }
  41. - (UILabel *)titleLabel{
  42. if (_titleLabel == nil) {
  43. _titleLabel = [[UILabel alloc]init];
  44. _titleLabel.font = [UIFont systemFontOfSize:14];
  45. _titleLabel.textColor = UIColorFromRGB(0x999999);
  46. _titleLabel.textAlignment = NSTextAlignmentCenter;
  47. _titleLabel.text = @"还没有评论,抢个沙发吧~";
  48. }
  49. return _titleLabel;
  50. }
  51. @end