JXTalkDetailView.m 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // JXTalkDetailView.m
  3. // shiku_im
  4. //
  5. // Created by p on 2019/8/16.
  6. // Copyright © 2019 Reese. All rights reserved.
  7. //
  8. #import "JXTalkDetailView.h"
  9. @implementation JXTalkDetailView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. if ([super initWithFrame:frame]) {
  12. self.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.2];
  13. [self customView];
  14. }
  15. return self;
  16. }
  17. - (void)customView {
  18. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchUpInside:)];
  19. [self addGestureRecognizer:tap];
  20. UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 228, 176)];
  21. contentView.center = CGPointMake(self.frame.size.width / 2, self.frame.size.height /2);
  22. contentView.backgroundColor = [UIColor whiteColor];
  23. contentView.layer.cornerRadius = 10.0;
  24. contentView.layer.masksToBounds = YES;
  25. [self addSubview:contentView];
  26. _headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, 52, 52)];
  27. _headImageView.center = CGPointMake(contentView.frame.size.width / 2, _headImageView.center.y);
  28. _headImageView.layer.cornerRadius = _headImageView.frame.size.width / 2;
  29. _headImageView.layer.masksToBounds = YES;
  30. [contentView addSubview:_headImageView];
  31. _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_headImageView.frame) + 10, contentView.frame.size.width, 16)];
  32. _nameLabel.textColor = HEXCOLOR(0x333333);
  33. _nameLabel.font = [UIFont systemFontOfSize:16.0];
  34. _nameLabel.textAlignment = NSTextAlignmentCenter;
  35. [contentView addSubview:_nameLabel];
  36. _lastLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_nameLabel.frame) + 20, contentView.frame.size.width, 14)];
  37. _lastLabel.textColor = HEXCOLOR(0x999999);
  38. _lastLabel.font = [UIFont systemFontOfSize:14.0];
  39. _lastLabel.textAlignment = NSTextAlignmentCenter;
  40. [contentView addSubview:_lastLabel];
  41. _talkLable = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_lastLabel.frame) + 10, contentView.frame.size.width, 14)];
  42. _talkLable.textColor = HEXCOLOR(0x999999);
  43. _talkLable.font = [UIFont systemFontOfSize:14.0];
  44. _talkLable.textAlignment = NSTextAlignmentCenter;
  45. [contentView addSubview:_talkLable];
  46. }
  47. - (void)touchUpInside:(id)sender {
  48. self.hidden = YES;
  49. }
  50. /*
  51. // Only override drawRect: if you perform custom drawing.
  52. // An empty implementation adversely affects performance during animation.
  53. - (void)drawRect:(CGRect)rect {
  54. // Drawing code
  55. }
  56. */
  57. @end