|
|
@@ -0,0 +1,230 @@
|
|
|
+//
|
|
|
+// editShareView.m
|
|
|
+// 双子星云手机
|
|
|
+//
|
|
|
+// Created by xd h on 2024/5/14.
|
|
|
+//
|
|
|
+
|
|
|
+#import "editShareView.h"
|
|
|
+
|
|
|
+@interface editShareView ()
|
|
|
+@property(nonatomic,strong) UIButton*day7Button;
|
|
|
+@property(nonatomic,strong) UIButton*dayForeverButton;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation editShareView
|
|
|
+
|
|
|
+- (id)initWithFrame:(CGRect)frame{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+ self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.6];
|
|
|
+ [self drawAnyView];
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+
|
|
|
+ UIView *whiteBgView = [[UIView alloc] init];
|
|
|
+ whiteBgView.backgroundColor = [UIColor whiteColor];
|
|
|
+ [self addSubview:whiteBgView];
|
|
|
+ whiteBgView.layer.cornerRadius = 32;
|
|
|
+ whiteBgView.layer.masksToBounds = YES;
|
|
|
+
|
|
|
+ [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(315 -50+ AdaptTabHeight);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
+ titleLabel.font = [UIFont systemFontOfSize:18.0];
|
|
|
+ titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
+ [whiteBgView addSubview:titleLabel];
|
|
|
+
|
|
|
+ NSString *leftText = NSLocalizedString(@"share_title_left",nil);
|
|
|
+ NSString *rightText = NSLocalizedString(@"share_title_right",nil);
|
|
|
+ NSString *totalStr = [[NSString alloc] initWithFormat:@"%@ %@",leftText,rightText];
|
|
|
+
|
|
|
+ NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
|
|
|
+ NSRange redRange = NSMakeRange([totalStr rangeOfString:rightText].location, [totalStr rangeOfString:rightText].length);
|
|
|
+ UIColor *noteColor =[UIColor hwColor:@"#959799" alpha:1.0];
|
|
|
+ [attrStr addAttribute:NSForegroundColorAttributeName value:noteColor range:redRange];
|
|
|
+ [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:redRange];
|
|
|
+ titleLabel.attributedText = attrStr;
|
|
|
+
|
|
|
+ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(25);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(20);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSString *secondTitleStr = NSLocalizedString(@"share_expiration_date",nil);
|
|
|
+ UILabel *secondTitleLabel = [[UILabel alloc] init];
|
|
|
+ secondTitleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ secondTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
|
|
|
+ secondTitleLabel.text = secondTitleStr;
|
|
|
+ [whiteBgView addSubview:secondTitleLabel];
|
|
|
+
|
|
|
+ CGFloat secondWith = [secondTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
|
|
|
+
|
|
|
+ [secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(25);
|
|
|
+ make.width.mas_equalTo(secondWith);
|
|
|
+ make.top.equalTo(titleLabel.mas_bottom).offset(10);
|
|
|
+ make.height.mas_equalTo(25);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ _day7Button = [[UIButton alloc] init];
|
|
|
+ [_day7Button setImage:[UIImage imageNamed:@"common_did_check"] forState:UIControlStateSelected];
|
|
|
+ [_day7Button setImage:[UIImage imageNamed:@"common_un_check"] forState:UIControlStateNormal];
|
|
|
+ [_day7Button setTitle:NSLocalizedString(@"share_expiration_date_7",nil) forState:UIControlStateNormal];
|
|
|
+ [_day7Button setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
|
|
|
+ [_day7Button addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _day7Button.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
+ _day7Button.tag = 1;
|
|
|
+ [whiteBgView addSubview:_day7Button];
|
|
|
+ _day7Button.selected = YES;
|
|
|
+
|
|
|
+ [_day7Button mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(secondTitleLabel.mas_right).offset(5);
|
|
|
+ make.width.mas_equalTo(100);
|
|
|
+ make.top.equalTo(secondTitleLabel.mas_top).offset(0);
|
|
|
+ make.height.mas_equalTo(25);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _dayForeverButton = [[UIButton alloc] init];
|
|
|
+ [_dayForeverButton setImage:[UIImage imageNamed:@"common_did_check"] forState:UIControlStateSelected];
|
|
|
+ [_dayForeverButton setImage:[UIImage imageNamed:@"common_un_check"] forState:UIControlStateNormal];
|
|
|
+ [_dayForeverButton setTitle:NSLocalizedString(@"share_expiration_date_forever",nil) forState:UIControlStateNormal];
|
|
|
+ [_dayForeverButton setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
|
|
|
+ [_dayForeverButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _dayForeverButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
+ _dayForeverButton.tag = 2;
|
|
|
+ [whiteBgView addSubview:_dayForeverButton];
|
|
|
+
|
|
|
+ [_dayForeverButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(_day7Button.mas_right).offset(15);
|
|
|
+ make.width.mas_equalTo(100);
|
|
|
+ make.top.equalTo(secondTitleLabel.mas_top).offset(0);
|
|
|
+ make.height.mas_equalTo(25);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSArray *titleArr = @[NSLocalizedString(@"share_by_weixin",nil),
|
|
|
+ NSLocalizedString(@"share_by_QQ",nil),
|
|
|
+ NSLocalizedString(@"share_by_timeLine",nil),
|
|
|
+ NSLocalizedString(@"share_by_secret",nil)];
|
|
|
+
|
|
|
+ NSArray *imageStrArr = @[@"share_weixin_icon",
|
|
|
+ @"share_qq_icon",
|
|
|
+ @"share_weixin_Timeline_icon",
|
|
|
+ @"share_secret_icon"];
|
|
|
+
|
|
|
+ CGFloat curButFullWidth = SCREEN_W/4.0;
|
|
|
+
|
|
|
+ for (int i = 0; i< titleArr.count; i++) {
|
|
|
+
|
|
|
+ UIButton*curButton = [[UIButton alloc] init];
|
|
|
+ [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ curButton.tag = 10+i;
|
|
|
+ [whiteBgView addSubview:curButton];
|
|
|
+
|
|
|
+ [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.left.mas_equalTo(i*curButFullWidth);
|
|
|
+ make.height.mas_equalTo(80);
|
|
|
+ make.top.equalTo(secondTitleLabel.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIView *imageBgView = [[UIView alloc] init];
|
|
|
+ imageBgView.backgroundColor = [UIColor hwColor:@"#F5F7FA"];
|
|
|
+ imageBgView.layer.cornerRadius = 8;
|
|
|
+ imageBgView.layer.masksToBounds = YES;
|
|
|
+ [curButton addSubview:imageBgView];
|
|
|
+
|
|
|
+ [imageBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(64);
|
|
|
+ make.height.mas_equalTo(52);
|
|
|
+ make.centerX.equalTo(curButton.mas_centerX);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIImageView *leftImageV = [[UIImageView alloc] init];
|
|
|
+ leftImageV.image = [UIImage imageNamed:imageStrArr[i]];
|
|
|
+ [imageBgView addSubview:leftImageV];
|
|
|
+
|
|
|
+ [leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(25);
|
|
|
+ make.height.mas_equalTo(25);
|
|
|
+ make.centerX.equalTo(imageBgView.mas_centerX);
|
|
|
+ make.centerY.equalTo(imageBgView.mas_centerY).offset(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UILabel *leftLabel = [[UILabel alloc] init];
|
|
|
+ leftLabel.textColor = [UIColor hwColor:@"#0A132B"];
|
|
|
+ leftLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
+ leftLabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
+ leftLabel.text = titleArr[i];
|
|
|
+ [curButton addSubview:leftLabel];
|
|
|
+
|
|
|
+ [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.height.mas_equalTo(25);
|
|
|
+ make.centerX.equalTo(curButton.mas_centerX);
|
|
|
+ make.top.equalTo(imageBgView.mas_bottom).offset(10);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ UIButton*cancelButton = [[UIButton alloc] init];
|
|
|
+ [cancelButton setTitle:NSLocalizedString(@"other_cancel",nil) forState:UIControlStateNormal];
|
|
|
+ [cancelButton setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
|
|
|
+ [cancelButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
+ cancelButton.tag = 100;
|
|
|
+ [whiteBgView addSubview:cancelButton];
|
|
|
+
|
|
|
+ [cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(-AdaptTabHeight);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIView *lineView = [[UIView alloc] init];
|
|
|
+ lineView.backgroundColor = [UIColor hwColor:@"#EAEAEA"];
|
|
|
+ [whiteBgView addSubview:lineView];
|
|
|
+
|
|
|
+ [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(25);
|
|
|
+ make.right.mas_equalTo(-25);
|
|
|
+ make.bottom.equalTo(cancelButton.mas_top).offset(-5);
|
|
|
+ make.height.mas_equalTo(1);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)didClickButFun:(UIButton*)but
|
|
|
+{
|
|
|
+ NSInteger tag = but.tag;
|
|
|
+
|
|
|
+ if(tag==1 && !_day7Button.selected){
|
|
|
+ _day7Button.selected = YES;
|
|
|
+ _dayForeverButton.selected = NO;
|
|
|
+ }
|
|
|
+ else if(tag==2 && !_dayForeverButton.selected){
|
|
|
+ _day7Button.selected = NO;
|
|
|
+ _dayForeverButton.selected = YES;
|
|
|
+ }
|
|
|
+ else if(tag == 100){
|
|
|
+ [self removeFromSuperview];
|
|
|
+ }
|
|
|
+
|
|
|
+// if(_didClickButtonFun){
|
|
|
+// _didClickButtonFun(tag);
|
|
|
+// }
|
|
|
+}
|
|
|
+
|
|
|
+@end
|
|
|
+
|