|
|
@@ -20,6 +20,9 @@
|
|
|
#import <TencentOpenAPI/QQApiInterfaceObject.h>
|
|
|
|
|
|
@interface editShareView ()<UITextFieldDelegate>
|
|
|
+
|
|
|
+@property(nonatomic,strong) UIView *whiteBgView;
|
|
|
+
|
|
|
@property(nonatomic,strong) UIButton*day7Button;
|
|
|
@property(nonatomic,strong) UIButton*dayForeverButton;
|
|
|
|
|
|
@@ -27,6 +30,10 @@
|
|
|
@property(nonatomic,strong) UITextField *shareNumberTF;
|
|
|
@property(nonatomic,strong) UIButton*reduceButton;//-
|
|
|
|
|
|
+@property(nonatomic,strong)UILabel *thridTitleLabel;
|
|
|
+@property(nonatomic,strong) UIButton*wxShareButton;
|
|
|
+@property(nonatomic,strong) UIButton*QQShareButton;
|
|
|
+@property(nonatomic,strong) UIButton*momentsShareButton;
|
|
|
@property(nonatomic,strong) UIButton*PrivacyShareButton;
|
|
|
@end
|
|
|
|
|
|
@@ -41,13 +48,27 @@
|
|
|
|
|
|
- (void)drawAnyView{
|
|
|
|
|
|
- UIView *whiteBgView = [[UIView alloc] init];
|
|
|
- whiteBgView.backgroundColor = [UIColor whiteColor];
|
|
|
- [self addSubview:whiteBgView];
|
|
|
- whiteBgView.layer.cornerRadius = 32;
|
|
|
- whiteBgView.layer.masksToBounds = YES;
|
|
|
+ //大按钮响应
|
|
|
+ UIButton *bigRightButton = [[UIButton alloc] init];
|
|
|
+ bigRightButton.tag = 1;
|
|
|
+ [bigRightButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self addSubview:bigRightButton];
|
|
|
+ //bigRightButton.backgroundColor= [UIColor greenColor];
|
|
|
+
|
|
|
+ [bigRightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _whiteBgView = [[UIView alloc] init];
|
|
|
+ _whiteBgView.backgroundColor = [UIColor whiteColor];
|
|
|
+ [self addSubview:_whiteBgView];
|
|
|
+ _whiteBgView.layer.cornerRadius = 32;
|
|
|
+ _whiteBgView.layer.masksToBounds = YES;
|
|
|
|
|
|
- [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
make.bottom.mas_equalTo(0);
|
|
|
@@ -58,7 +79,7 @@
|
|
|
UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
titleLabel.font = [UIFont systemFontOfSize:18.0];
|
|
|
titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
- [whiteBgView addSubview:titleLabel];
|
|
|
+ [_whiteBgView addSubview:titleLabel];
|
|
|
|
|
|
NSString *leftText = NSLocalizedString(@"share_title_left",nil);
|
|
|
NSString *rightText = NSLocalizedString(@"share_title_right",nil);
|
|
|
@@ -83,7 +104,7 @@
|
|
|
secondTitleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
secondTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
|
|
|
secondTitleLabel.text = secondTitleStr;
|
|
|
- [whiteBgView addSubview:secondTitleLabel];
|
|
|
+ [_whiteBgView addSubview:secondTitleLabel];
|
|
|
|
|
|
CGFloat secondWith = [secondTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
|
|
|
|
|
|
@@ -103,7 +124,7 @@
|
|
|
[_day7Button addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_day7Button.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
_day7Button.tag = 1;
|
|
|
- [whiteBgView addSubview:_day7Button];
|
|
|
+ [_whiteBgView addSubview:_day7Button];
|
|
|
_day7Button.selected = YES;
|
|
|
|
|
|
[_day7Button mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
@@ -121,7 +142,7 @@
|
|
|
[_dayForeverButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_dayForeverButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
_dayForeverButton.tag = 2;
|
|
|
- [whiteBgView addSubview:_dayForeverButton];
|
|
|
+ [_whiteBgView addSubview:_dayForeverButton];
|
|
|
|
|
|
[_dayForeverButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.equalTo(_day7Button.mas_right).offset(15);
|
|
|
@@ -132,15 +153,15 @@
|
|
|
|
|
|
//1.4.1 添加分享次数限制
|
|
|
NSString *thridTitleStr = NSLocalizedString(@"share_number_limit_title",nil);
|
|
|
- UILabel *thridTitleLabel = [[UILabel alloc] init];
|
|
|
- thridTitleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
- thridTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
|
|
|
- thridTitleLabel.text = thridTitleStr;
|
|
|
- [whiteBgView addSubview:thridTitleLabel];
|
|
|
+ _thridTitleLabel = [[UILabel alloc] init];
|
|
|
+ _thridTitleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ _thridTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
|
|
|
+ _thridTitleLabel.text = thridTitleStr;
|
|
|
+ [_whiteBgView addSubview:_thridTitleLabel];
|
|
|
|
|
|
CGFloat thridWith = [thridTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width + 10;
|
|
|
|
|
|
- [thridTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [_thridTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(25);
|
|
|
make.width.mas_equalTo(thridWith);
|
|
|
make.top.equalTo(secondTitleLabel.mas_bottom).offset(10);
|
|
|
@@ -152,12 +173,12 @@
|
|
|
[_addButton setImage:[UIImage imageNamed:@"common_add_N"] forState:UIControlStateNormal];
|
|
|
[_addButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_addButton.tag = 3;
|
|
|
- [whiteBgView addSubview:_addButton];
|
|
|
+ [_whiteBgView addSubview:_addButton];
|
|
|
_addButton.enabled = NO;
|
|
|
|
|
|
[_addButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.right.mas_equalTo(-20);
|
|
|
- make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
|
|
|
+ make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
|
|
|
make.width.mas_equalTo(30);
|
|
|
make.height.mas_equalTo(30);
|
|
|
}];
|
|
|
@@ -171,12 +192,12 @@
|
|
|
_shareNumberTF.text = @"80";
|
|
|
_shareNumberTF.delegate = self;
|
|
|
_shareNumberTF.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
- [whiteBgView addSubview:_shareNumberTF];
|
|
|
+ [_whiteBgView addSubview:_shareNumberTF];
|
|
|
[_shareNumberTF setTintColor:[UIColor hwColor:@"#01B7EA" alpha:1.0]];
|
|
|
|
|
|
[_shareNumberTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.right.equalTo(_addButton.mas_left).offset(-5);
|
|
|
- make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
|
|
|
+ make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
|
|
|
make.width.mas_equalTo(50);
|
|
|
make.height.mas_equalTo(25);
|
|
|
}];
|
|
|
@@ -186,11 +207,11 @@
|
|
|
[_reduceButton setImage:[UIImage imageNamed:@"common_reduce_N"] forState:UIControlStateNormal];
|
|
|
[_reduceButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
_reduceButton.tag = 4;
|
|
|
- [whiteBgView addSubview:_reduceButton];
|
|
|
+ [_whiteBgView addSubview:_reduceButton];
|
|
|
|
|
|
[_reduceButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.right.equalTo(_shareNumberTF.mas_left).offset(-5);
|
|
|
- make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
|
|
|
+ make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
|
|
|
make.width.mas_equalTo(30);
|
|
|
make.height.mas_equalTo(30);
|
|
|
}];
|
|
|
@@ -214,16 +235,25 @@
|
|
|
UIButton*curButton = [[UIButton alloc] init];
|
|
|
[curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
curButton.tag = 10+i;
|
|
|
- [whiteBgView addSubview:curButton];
|
|
|
+ [_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(thridTitleLabel.mas_bottom).offset(20);
|
|
|
+ make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
|
|
|
}];
|
|
|
|
|
|
- if(i== titleArr.count -1){
|
|
|
+ if(i== 0){
|
|
|
+ _wxShareButton = curButton;
|
|
|
+ }
|
|
|
+ else if(i== 1){
|
|
|
+ _QQShareButton = curButton;
|
|
|
+ }
|
|
|
+ else if(i== 2){
|
|
|
+ _momentsShareButton= curButton;
|
|
|
+ }
|
|
|
+ else if(i== 3){
|
|
|
_PrivacyShareButton = curButton;
|
|
|
}
|
|
|
|
|
|
@@ -275,7 +305,7 @@
|
|
|
[cancelButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
|
|
cancelButton.tag = 100;
|
|
|
- [whiteBgView addSubview:cancelButton];
|
|
|
+ [_whiteBgView addSubview:cancelButton];
|
|
|
|
|
|
[cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
@@ -286,7 +316,7 @@
|
|
|
|
|
|
UIView *lineView = [[UIView alloc] init];
|
|
|
lineView.backgroundColor = [UIColor hwColor:@"#EAEAEA"];
|
|
|
- [whiteBgView addSubview:lineView];
|
|
|
+ [_whiteBgView addSubview:lineView];
|
|
|
|
|
|
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(25);
|
|
|
@@ -298,7 +328,7 @@
|
|
|
UILabel *tipLabel = [[UILabel alloc] init];
|
|
|
tipLabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
tipLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
|
|
|
- [whiteBgView addSubview:tipLabel];
|
|
|
+ [_whiteBgView addSubview:tipLabel];
|
|
|
|
|
|
NSString *TipText = NSLocalizedString(@"share_file_tip_msg",nil);
|
|
|
tipLabel.text = TipText;
|
|
|
@@ -357,7 +387,7 @@
|
|
|
|
|
|
_addButton.enabled = YES;
|
|
|
}
|
|
|
- else if(tag == 100){
|
|
|
+ else if(tag == 100 || tag ==1){
|
|
|
[self removeFromSuperview];
|
|
|
}
|
|
|
else{
|
|
|
@@ -605,5 +635,68 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)setIsPortraitType:(BOOL)isPortraitType
|
|
|
+{
|
|
|
+ _isPortraitType = isPortraitType;
|
|
|
+
|
|
|
+ CGFloat curButFullWidth = 0.0;
|
|
|
+
|
|
|
+ if(_isPortraitType){
|
|
|
+ _whiteBgView.layer.cornerRadius = 32;
|
|
|
+ [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(345 + AdaptTabHeight);
|
|
|
+ }];
|
|
|
+
|
|
|
+ CGFloat width = SCREEN_W < SCREEN_H ? SCREEN_W : SCREEN_H;
|
|
|
+ curButFullWidth = width/4.0;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ CGFloat height = SCREEN_W < SCREEN_H ? SCREEN_W : SCREEN_H;
|
|
|
+
|
|
|
+ _whiteBgView.layer.cornerRadius = 0;
|
|
|
+ [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(400);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ //make.height.mas_equalTo(345 + AdaptTabHeight);
|
|
|
+ make.height.mas_equalTo(height);
|
|
|
+ }];
|
|
|
+
|
|
|
+ curButFullWidth = 400.0/4.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ //四个分享按钮
|
|
|
+ [_wxShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.left.mas_equalTo(0*curButFullWidth);
|
|
|
+ make.height.mas_equalTo(80);
|
|
|
+ make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_QQShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.left.mas_equalTo(1*curButFullWidth);
|
|
|
+ make.height.mas_equalTo(80);
|
|
|
+ make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_momentsShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.left.mas_equalTo(2*curButFullWidth);
|
|
|
+ make.height.mas_equalTo(80);
|
|
|
+ make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [_PrivacyShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(curButFullWidth);
|
|
|
+ make.left.mas_equalTo(3*curButFullWidth);
|
|
|
+ make.height.mas_equalTo(80);
|
|
|
+ make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
@end
|
|
|
|