Files
real-e-party-iOS/YuMi/Modules/YMWeb/PIWebViewSavePhotoView.m
edwinQQQ a35a711be6 chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked)
- Removed YuMi/Resources/ (23 MB, not tracked)
- Removed old version assets (566 files, not tracked)
- Excluded Pods/, xcuserdata/ and other build artifacts
- Clean repository optimized for company server deployment
2025-10-09 16:19:14 +08:00

181 lines
6.0 KiB
Objective-C

//
// PIWebViewSavePhotoView.m
// YuMi
//
// Created by duoban on 2024/3/14.
//
#import "PIWebViewSavePhotoView.h"
@interface PIWebViewSavePhotoView()
@property(nonatomic,strong) UIImageView *topView;
@property(nonatomic,strong) UIImageView *bottomView;
@property(nonatomic,strong) UIImageView *topTextImageView;
@property(nonatomic,strong) UIView *bgCodeView;
@property(nonatomic,strong) UIImageView *bgCodeText;
@property(nonatomic,strong) UILabel *codeText;
@property(nonatomic,strong) NetImageView *codeView;
@property(nonatomic,strong) UILabel *tipView;
@property(nonatomic,strong) UIButton *codeBtn;
@end
@implementation PIWebViewSavePhotoView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
[self addSubview:self.topView];
[self addSubview:self.bottomView];
[self addSubview:self.topTextImageView];
[self addSubview:self.bgCodeView];
[self.bgCodeView addSubview:self.bgCodeText];
[self.bgCodeText addSubview:self.codeText];
[self.bgCodeView addSubview:self.codeView];
[self.bgCodeView addSubview:self.tipView];
[self.bgCodeView addSubview:self.codeBtn];
}
-(void)installConstraints{
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.mas_equalTo(0);
make.height.mas_equalTo(kGetScaleWidth(326));
}];
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.equalTo(self);
make.top.mas_equalTo(kGetScaleWidth(303));
make.height.mas_equalTo(kGetScaleWidth(509));
}];
[self.topTextImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(132));
make.width.mas_equalTo(kGetScaleWidth(297));
make.height.mas_equalTo(kGetScaleWidth(32.5));
make.centerX.equalTo(self);
}];
[self.bgCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(345));
make.height.mas_equalTo(kGetScaleWidth(431));
make.top.equalTo(self.topTextImageView.mas_bottom).mas_offset(kGetScaleWidth(186.5));
make.centerX.equalTo(self);
}];
[self.bgCodeText mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.equalTo(self.bgCodeView);
make.width.mas_equalTo(kGetScaleWidth(290));
make.height.mas_equalTo(kGetScaleWidth(43));
}];
[self.codeText mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(3));
make.bottom.mas_equalTo(-kGetScaleWidth(3));
make.leading.trailing.equalTo(self.bgCodeText).inset(kGetScaleWidth(10));
}];
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(200));
make.centerX.equalTo(self.bgCodeView);
make.top.mas_equalTo(kGetScaleWidth(96));
}];
[self.tipView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(321));
make.height.mas_equalTo(kGetScaleWidth(14));
make.centerX.equalTo(self.bgCodeView);
}];
[self.codeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(355));
make.width.mas_equalTo(kGetScaleWidth(241));
make.height.mas_equalTo(kGetScaleWidth(46));
make.centerX.equalTo(self.bgCodeView);
}];
}
-(void)setText:(NSString *)text{
_text = text;
_codeText.text = text;
}
-(void)setImage:(UIImage *)image{
_image = image;
_codeView.image = _image;
}
- (void)setCode:(NSString *)code{
_code = code;
NSString *text = [NSString stringWithFormat:@"%@%@",YMLocalizedString(@"PIWebViewSavePhotoView1"),_code];
[_codeBtn setTitle:text forState:UIControlStateNormal];
}
#pragma mark - 懒加载
- (UIImageView *)topView{
if(!_topView){
_topView = [UIImageView new];
_topView.image = kImage(@"pi_webView_code_top");
}
return _topView;
}
- (UIImageView *)bottomView{
if(!_bottomView){
_bottomView = [UIImageView new];
_bottomView.image = kImage(@"pi_webView_code_bottom");
}
return _bottomView;
}
- (UIImageView *)topTextImageView{
if(!_topTextImageView){
_topTextImageView = [UIImageView new];
_topTextImageView.image = [UIImage getLanguageImage:@"pi_webView_code_top_text"];
}
return _topTextImageView;
}
- (UIImageView *)bgCodeText{
if(!_bgCodeText){
_bgCodeText = [UIImageView new];
_bgCodeText.image = kImage(@"pi_webView_code_code_text");
}
return _bgCodeText;
}
- (UIView *)bgCodeView{
if(!_bgCodeView){
_bgCodeView = [UIView new];
_bgCodeView.layer.cornerRadius = kGetScaleWidth(20);
_bgCodeView.layer.masksToBounds = YES;
_bgCodeView.backgroundColor = [UIColor whiteColor];
}
return _bgCodeView;
}
- (UILabel *)codeText{
if(!_codeText){
_codeText = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
_codeText.textAlignment = NSTextAlignmentCenter;
_codeText.numberOfLines = 0;
}
return _codeText;
}
- (UILabel *)tipView{
if(!_tipView){
_tipView = [UILabel labelInitWithText:YMLocalizedString(@"PIWebViewSavePhotoView0") font:kFontRegular(10) textColor:UIColorFromRGB(0x999999)];
}
return _tipView;
}
- (UIButton *)codeBtn{
if(!_codeBtn){
_codeBtn = [UIButton new];
NSString *text = [NSString stringWithFormat:@"%@GHT32",YMLocalizedString(@"PIWebViewSavePhotoView1")];
[_codeBtn setTitle:text forState:UIControlStateNormal];
_codeBtn.titleLabel.font = kFontRegular(16);
[_codeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_codeBtn setBackgroundImage:kImage(@"pi_webView_code_btn_bg") forState:UIControlStateNormal];
}
return _codeBtn;
}
- (NetImageView *)codeView{
if(!_codeView){
_codeView = [NetImageView new];
}
return _codeView;
}
@end