JXMyTopView.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // JXMyTopView.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/5/15.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXMyTopView.h"
  9. #import "MJButton.h"
  10. @interface JXMyTopView()
  11. @end
  12. @implementation JXMyTopView
  13. +(instancetype)XIBJXXMGTopView{
  14. return [[NSBundle mainBundle]loadNibNamed:@"JXMyTopView" owner:self options:nil].firstObject;
  15. }
  16. -(void)awakeFromNib{
  17. [super awakeFromNib];;
  18. self.headMyIMG.layer.cornerRadius=35;
  19. self.headMyIMG.layer.masksToBounds=YES;
  20. NSArray * titles=@[@"即信客服",@"QQ客服",@"电话客服",@"视频客服"];
  21. NSArray * imageS=@[@"jxkf",@"qkf",@"dhk",@"spkf"];
  22. CGFloat titBtnH =(JX_SCREEN_WIDTH-20-80)/4;
  23. for(int i =0; i <titles.count; i++){
  24. MJButton *titBtn = [MJButton buttonWithType:UIButtonTypeCustom];
  25. //titBtn.backgroundColor=[UIColor yellowColor];
  26. [titBtn setImage:[UIImage imageNamed:imageS[i]] forState:UIControlStateNormal];
  27. [titBtn setTitle:titles[i] forState:UIControlStateNormal];
  28. titBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
  29. titBtn.tag=i;
  30. [_titleBtnView addSubview:titBtn];
  31. [titBtn addTarget:self action:@selector(phbangAndPackageBtn:) forControlEvents:UIControlEventTouchUpInside];
  32. titBtn.frame=CGRectMake(5+i*(titBtnH +20), 10, titBtnH, titBtnH);
  33. }
  34. }
  35. /**
  36. * 排行榜。即信钱包
  37. */
  38. - (IBAction)phbangAndPackageBtn:(UIButton *)sender {
  39. if (_paihangbang) {
  40. _paihangbang(sender);
  41. }
  42. }
  43. - (void)titleClick:(UIButton *)button{
  44. if (_topViewBlockBtn) {
  45. _topViewBlockBtn(button);
  46. }
  47. }
  48. @end