MePTableViewCell.m 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // MePTableViewCell.m
  3. // FanweApp
  4. //
  5. // Created by ycp on 16/10/22.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "MePTableViewCell.h"
  9. @implementation MePTableViewCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier photoWidth:(CGFloat)width phototHeight:(CGFloat)height{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self)
  13. {
  14. self.photoImageView =[[UIImageView alloc] init];
  15. self.labelText =[[UILabel alloc] init];
  16. self.detailLabel =[[UILabel alloc] init];
  17. if (kScreenW==375)
  18. {
  19. self.photoImageView.frame =CGRectMake(10, (50-height)/2, width, height);
  20. self.labelText.center =self.photoImageView.center;
  21. CGRect newFrame =self.photoImageView.frame;
  22. newFrame.origin.x =self.photoImageView.frame.origin.x+self.photoImageView.frame.size.width+10;
  23. newFrame.size.width =100;
  24. self.labelText.frame=newFrame;
  25. self.detailLabel.center =self.photoImageView.center;
  26. CGRect Frame =self.photoImageView.frame;
  27. Frame.origin.x =150;
  28. Frame.size.width =kScreenW-150-35;
  29. self.detailLabel.frame=Frame;
  30. self.labelText.font = kAppMiddleTextFont;
  31. self.detailLabel.font = kAppSmallTextFont;
  32. }else if(kScreenW>375)
  33. {
  34. self.photoImageView.frame =CGRectMake(10, (55-height)/2, width, height);
  35. self.labelText.center =self.photoImageView.center;
  36. CGRect newFrame =self.photoImageView.frame;
  37. newFrame.origin.x =self.photoImageView.frame.origin.x+self.photoImageView.frame.size.width+10;
  38. newFrame.size.width =100;
  39. self.labelText.frame=newFrame;
  40. self.detailLabel.center =self.photoImageView.center;
  41. CGRect Frame =self.photoImageView.frame;
  42. Frame.origin.x =150;
  43. Frame.size.width =kScreenW-150-35;
  44. self.detailLabel.frame=Frame;
  45. self.labelText.font =kAppMiddleTextFont;
  46. self.detailLabel.font = kAppMiddleTextFont;
  47. }else
  48. {
  49. self.photoImageView.frame =CGRectMake(10, (44-height)/2, width, height);
  50. self.labelText.center =self.photoImageView.center;
  51. CGRect newFrame =self.photoImageView.frame;
  52. newFrame.origin.x =self.photoImageView.frame.origin.x+self.photoImageView.frame.size.width+10;
  53. newFrame.size.width =100;
  54. self.labelText.frame=newFrame;
  55. self.detailLabel.center =self.photoImageView.center;
  56. CGRect Frame =self.photoImageView.frame;
  57. Frame.origin.x =150;
  58. Frame.size.width =kScreenW-150-35;
  59. self.detailLabel.frame=Frame;
  60. self.labelText.font =kAppMiddleTextFont;
  61. self.detailLabel.font = kAppSmallTextFont;
  62. }
  63. self.labelText.textColor=RGB(75, 76, 77);
  64. self.detailLabel.textColor =kAppSecondaryColor;
  65. self.detailLabel.textAlignment =NSTextAlignmentRight;
  66. [self.contentView addSubview:self.photoImageView];
  67. [self.contentView addSubview:self.labelText];
  68. [self.contentView addSubview:self.detailLabel];
  69. }
  70. return self;
  71. }
  72. @end