RITLPhotosBottomView.m 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //
  2. // RITLPhotosBottomView.m
  3. // RITLPhotoDemo
  4. //
  5. // Created by YueWen on 2018/3/9.
  6. // Copyright © 2018年 YueWen. All rights reserved.
  7. //
  8. #import "RITLPhotosBottomView.h"
  9. #import "RITLPhotosConfiguration.h"
  10. #import "NSBundle+RITLPhotos.h"
  11. #import "RITLKit.h"
  12. #import "Masonry.h"
  13. @interface RITLPhotosBottomView ()
  14. @property (nonatomic, strong) NSString *language;
  15. @end
  16. @implementation RITLPhotosBottomView
  17. -(instancetype)initWithFrame:(CGRect)frame
  18. {
  19. if (self = [super initWithFrame:frame]) {
  20. _language = [[NSString alloc] initWithFormat:@"%@",g_constant.sysLanguage];
  21. [self buildViews];
  22. }
  23. return self;
  24. }
  25. - (void)buildViews
  26. {
  27. self.contentView = ({
  28. UIView *view = [UIView new];
  29. view.backgroundColor = UIColor.clearColor;
  30. view;
  31. });
  32. self.previewButton = ({
  33. UIButton *view = [UIButton new];
  34. view.adjustsImageWhenHighlighted = false;
  35. view.backgroundColor = [UIColor clearColor];
  36. view.titleLabel.font = [UIFont systemFontOfSize:15];
  37. [view setTitle:NSLocalizedString(Localized(@"JX_Preview"), @"") forState:UIControlStateNormal];
  38. [view setTitle:NSLocalizedString(Localized(@"JX_Preview"), @"") forState:UIControlStateDisabled];
  39. [view setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  40. [view setTitleColor:RITLColorFromIntRBG(105, 109, 113) forState:UIControlStateDisabled];
  41. view;
  42. });
  43. if (![RITLPhotosConfiguration defaultConfiguration].isRichScan) {
  44. self.fullImageButton = ({
  45. UIButton *view = [UIButton new];
  46. if ([_language isEqualToString:@"en"]) {
  47. view.imageEdgeInsets = UIEdgeInsetsMake(5, 0, 5, 40+40+10+20);
  48. view.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
  49. } else {
  50. view.imageEdgeInsets = UIEdgeInsetsMake(5, 0, 5, 40);
  51. view.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
  52. }
  53. [view setImage:/*@"RITLPhotos.bundle/ritl_bottomUnselected".ritl_image*/NSBundle.ritl_bottomUnselected forState:UIControlStateNormal];
  54. [view setImage:/*@"RITLPhotos.bundle/ritl_bottomSelected".ritl_image*/NSBundle.ritl_bottomSelected forState:UIControlStateSelected];
  55. view.titleLabel.font = [UIFont systemFontOfSize:14];
  56. [view setTitle:NSLocalizedString(Localized(@"JX_OriginalImage"), @"") forState:UIControlStateNormal];
  57. [view setTitle:NSLocalizedString(Localized(@"JX_OriginalImage"), @"") forState:UIControlStateSelected];
  58. [view setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  59. view;
  60. });
  61. }
  62. self.sendButton = ({
  63. UIButton *view = [UIButton new];
  64. view.adjustsImageWhenHighlighted = false;
  65. view.titleLabel.font = RITLUtilityFont(RITLFontPingFangSC_Regular, 13);
  66. if (![RITLPhotosConfiguration defaultConfiguration].isRichScan) {
  67. [view setTitle:NSLocalizedString(Localized(@"JX_Send"), @"") forState:UIControlStateNormal];
  68. [view setTitle:NSLocalizedString(Localized(@"JX_Send"), @"") forState:UIControlStateDisabled];
  69. }else {
  70. [view setTitle:NSLocalizedString(Localized(@"JX_Finish"), @"") forState:UIControlStateNormal];
  71. [view setTitle:NSLocalizedString(Localized(@"JX_Finish"), @"") forState:UIControlStateDisabled];
  72. }
  73. [view setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  74. [view setTitleColor:RITLColorFromIntRBG(92, 134, 90) forState:UIControlStateDisabled];
  75. [view setBackgroundImage:RITLColorFromIntRBG(9, 187, 7).ritl_image forState:UIControlStateNormal];
  76. [view setBackgroundImage:RITLColorFromIntRBG(23, 83, 23).ritl_image forState:UIControlStateDisabled];
  77. view.layer.cornerRadius = 5;
  78. view.clipsToBounds = true;
  79. view;
  80. });
  81. [self addSubview:self.contentView];
  82. [self.contentView addSubview:self.previewButton];
  83. [self.contentView addSubview:self.fullImageButton];
  84. [self.contentView addSubview:self.sendButton];
  85. [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.top.left.right.offset(0);
  87. make.height.mas_equalTo(RITL_NormalTabBarHeight - 5);
  88. }];
  89. [self.previewButton mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.centerY.offset(0);
  91. make.left.offset(10);
  92. if ([_language isEqualToString:@"en"]) {
  93. make.width.mas_equalTo(40+20);
  94. } else {
  95. make.width.mas_equalTo(40);
  96. }
  97. }];
  98. [self.fullImageButton mas_makeConstraints:^(MASConstraintMaker *make) {
  99. make.center.offset(0);
  100. make.height.mas_equalTo(30);
  101. if ([_language isEqualToString:@"en"]) {
  102. make.width.mas_equalTo(60+40+10+20);
  103. } else {
  104. make.width.mas_equalTo(60);
  105. }
  106. }];
  107. [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
  108. make.centerY.offset(0);
  109. make.right.inset(10);
  110. make.width.mas_equalTo(65);
  111. make.height.mas_equalTo(30);
  112. }];
  113. }
  114. - (void)setIsEdit:(BOOL)isEdit {
  115. _isEdit = isEdit;
  116. if (isEdit) {
  117. [self.previewButton setTitle:Localized(@"JX_Edit") forState:UIControlStateNormal];
  118. [self.previewButton setTitle:Localized(@"JX_Edit") forState:UIControlStateDisabled];
  119. }else {
  120. [self.previewButton setTitle:Localized(@"JX_Preview") forState:UIControlStateNormal];
  121. [self.previewButton setTitle:Localized(@"JX_Preview") forState:UIControlStateDisabled];
  122. }
  123. }
  124. @end