隐藏苹果登录并调整高度

This commit is contained in:
liyuhua
2023-08-17 15:18:17 +08:00
parent 030b46355a
commit 4e06319085

View File

@@ -54,7 +54,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
///qq ///qq
@property (nonatomic, strong) UIButton *lineButtonView; @property (nonatomic, strong) UIButton *lineButtonView;
@property (nonatomic, strong) UIButton *appleButton;
/// ///
@property (nonatomic,strong) GIDConfiguration *configuration; @property (nonatomic,strong) GIDConfiguration *configuration;
@@ -89,9 +89,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
} }
- (void)createUI { - (void)createUI {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@"hadAgree" forKey:HadAgreePrivacy];
[defaults synchronize];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.bgImageView]; [self.view addSubview:self.bgImageView];
[self.view addSubview:self.logoView]; [self.view addSubview:self.logoView];
@@ -104,10 +101,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
[self.view addSubview:self.authBubbleView]; [self.view addSubview:self.authBubbleView];
[self.authBubbleView addSubview:self.authBubbleLabel]; [self.authBubbleView addSubview:self.authBubbleLabel];
if (@available(iOS 13.0, *)) {
[self.stackView addArrangedSubview:self.appleButton];
}
self.appleButton.hidden = YES;
[self.stackView addArrangedSubview:self.googleButtonView]; [self.stackView addArrangedSubview:self.googleButtonView];
[self.stackView addArrangedSubview:self.fbButtonView]; [self.stackView addArrangedSubview:self.fbButtonView];
[self.stackView addArrangedSubview:self.lineButtonView]; [self.stackView addArrangedSubview:self.lineButtonView];
@@ -125,7 +119,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
}]; }];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.self.logoView.mas_bottom).offset(kGetScaleWidth(60)); make.top.mas_equalTo(self.self.logoView.mas_bottom).offset(kGetScaleWidth(122));
make.centerX.mas_equalTo(self.view); make.centerX.mas_equalTo(self.view);
}]; }];
@@ -161,10 +155,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
make.bottom.mas_equalTo(self.authBubbleView).mas_offset(-6); make.bottom.mas_equalTo(self.authBubbleView).mas_offset(-6);
}]; }];
[self.appleButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(295));
make.height.mas_equalTo(kGetScaleWidth(46));
}];
[self.googleButtonView mas_makeConstraints:^(MASConstraintMaker *make) { [self.googleButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(295)); make.width.mas_equalTo(kGetScaleWidth(295));
make.height.mas_equalTo(kGetScaleWidth(46)); make.height.mas_equalTo(kGetScaleWidth(46));
@@ -180,21 +171,17 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"]; id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"];
if(type != nil){ if(type != nil){
UIButton *typeButton ;
if([type intValue] == ThirdLoginType_Apple){
typeButton = self.appleButton;
}else if([type intValue] == ThirdLoginType_Gmail){
typeButton = self.googleButtonView;
}else if([type intValue] == ThirdLoginType_FB){
typeButton = self.fbButtonView;
}else if([type intValue] == ThirdLoginType_Line){
typeButton = self.lineButtonView;
}
if(typeButton == nil){
return;
}
[self.view addSubview:self.nextView]; [self.view addSubview:self.nextView];
[self.nextView addSubview:self.nextLabel]; [self.nextView addSubview:self.nextLabel];
UIButton *typeButton ;
if([type intValue] == 8){
typeButton = self.googleButtonView;
}else if([type intValue] == 10){
typeButton = self.fbButtonView;
}else{
typeButton = self.lineButtonView;
}
[self.nextView mas_makeConstraints:^(MASConstraintMaker *make) { [self.nextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-kGetScaleWidth(28)); make.trailing.mas_equalTo(-kGetScaleWidth(28));
make.width.mas_equalTo(kGetScaleWidth(70)); make.width.mas_equalTo(kGetScaleWidth(70));
@@ -446,22 +433,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
} }
return _lineButtonView; return _lineButtonView;
} }
- (UIButton *)appleButton {
if (!_appleButton) {
_appleButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_appleButton setImage: [UIImage imageNamed:@"login_apple"] forState:UIControlStateNormal];
[_appleButton setTitle:YMLocalizedString(@"XPLoginViewController12") forState:UIControlStateNormal];
_appleButton.titleLabel.font = kFontMedium(16);
[_appleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_appleButton setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
_appleButton.backgroundColor = UIColorFromRGB(0x141414);
_appleButton.layer.cornerRadius = kGetScaleWidth(46)/2;
_appleButton.layer.masksToBounds = YES;
_appleButton.tag = 1000 + ThirdLoginType_Apple;
[_appleButton addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _appleButton;
}
- (GIDConfiguration *)configuration{ - (GIDConfiguration *)configuration{