SPSBViewManager.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // SPSBViewManager.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/20.
  6. //
  7. #import "SPSBViewManager.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. UIView *spsb_createNumberTipsViewWithTag(NSInteger tag) {
  10. UIView *tipsView = [[UIView alloc] init];
  11. tipsView.tag = tag;
  12. tipsView.backgroundColor = spsb_FFFFFF_color(1.f);
  13. [tipsView setLayerCornerRadius:9.5 clipToBounds:false];
  14. UIView *redView = [[UIView alloc] init];
  15. redView.backgroundColor = spsb_FF5E5E_color();
  16. [redView setLayerCornerRadius:8 clipToBounds:false];
  17. [tipsView addSubview:redView];
  18. [redView makeConstraints:^(JXHConstraintMaker *make) {
  19. make.edges.equalTo(UIEdgeInsetsMake(1.5, 1.5, 1.5, 1.5));
  20. make.height.equalTo(16);
  21. make.width.greaterThanOrEqualTo(16);
  22. }];
  23. UILabel *num = [UILabel convenienceWithFont:spsb_semiboldFont(11) text:@"0" textColor:spsb_FFFFFF_color(1.f) textAlignment:NSTextAlignmentCenter];
  24. num.tag = spsb_numberTipsViewLabelTag;
  25. [redView addSubview:num];
  26. [num makeConstraints:^(JXHConstraintMaker *make) {
  27. make.leading.greaterThanOrEqualTo(4);
  28. make.trailing.lessThanOrEqualTo(-4);
  29. make.center.equalTo(redView).priorityRequired();
  30. }];
  31. return tipsView;
  32. }
  33. UIView *spsb_createShotViewHeaderWithTitle(NSString *title, SEL action, id target) {
  34. UIView *headerView = UIView.new;
  35. UIView *icon = UIView.new;
  36. icon.backgroundColor = spsb_3296FB_color();
  37. [icon setLayerCornerRadius:1.5 clipToBounds:false];
  38. [headerView addSubview:icon];
  39. [icon makeConstraints:^(JXHConstraintMaker *make) {
  40. make.leading.equalTo(15);
  41. make.top.equalTo(headerView.top).offset(20);
  42. make.size.equalTo(CGSizeMake(3, 16));
  43. }];
  44. UILabel *titleLabel = [UILabel convenienceWithFont:spsb_semiboldFont(16) textColor:spsb_333333_color() limitWidth:jxh_screenWidth() - 30 - 54];
  45. titleLabel.tag = spsb_headerViewLabelTag;
  46. [titleLabel setAttributedStringWithText:title lineSpacing:6];
  47. [headerView addSubview:titleLabel];
  48. [titleLabel makeConstraints:^(JXHConstraintMaker *make) {
  49. make.leading.equalTo(30);
  50. make.trailing.equalTo(-54);
  51. make.top.equalTo(17);
  52. make.bottom.equalTo(-17);
  53. }];
  54. UIButton *closeButton = [UIButton convenienceWithTarget:target action:action];
  55. [headerView addSubview:closeButton];
  56. [closeButton makeConstraints:^(JXHConstraintMaker *make) {
  57. make.top.and.trailing.equalTo(0);
  58. make.size.equalTo(CGSizeMake(54, 54));
  59. }];
  60. UIImageView *closeImageView = [[UIImageView alloc] initWithImage:jxh_getImage(close)];
  61. [headerView addSubview:closeImageView];
  62. [closeImageView makeConstraints:^(JXHConstraintMaker *make) {
  63. make.trailing.equalTo(-16);
  64. make.centerY.equalTo(closeButton);
  65. }];
  66. [headerView createLineWithLocation:JXHLineLocationBottom];
  67. return headerView;
  68. }