Commit 3d32af91 cgx

头像图片黑夜模式适配

1 个父辈 9bbde2ef
......@@ -94,6 +94,7 @@
- (UIImageView *)portraitIV {
if (!_portraitIV) {
_portraitIV = [UIImageView new];
_portraitIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, .5);
[_portraitIV yy_setImageWithURL:[NSURL URLWithString:[LoginUtils getFaceImg]] placeholder:[UIImage imageNamed:@"portrait"]];
[_portraitIV cornerRadius:145/2.0];
}
......@@ -103,6 +104,7 @@
- (UIImageView *)cameraIV {
if (!_cameraIV) {
_cameraIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cameraIcon"]];
_cameraIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, .5);
}
return _cameraIV;
}
......
......@@ -13,7 +13,7 @@
#import "UserRequestModel.h"
@interface UserInfoView () <InfoModifyAlertViewDelegate, DSImagePickerControllerDelegate, RSKImageCropViewControllerDelegate>
@property (nonatomic, strong) UIButton *portraitBtn;
@property (nonatomic, strong) UIImageView *portraitIV;
@property (nonatomic, strong) InfoModifyAlertView *photoAlertView;
@property (nonatomic, strong) UserInfoTableView *userInfoTV;
@property (nonatomic, strong) UIButton *layoutBtn;
......@@ -25,7 +25,7 @@
if (self = [super initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))]) {
_delegate = delegate;
[self.portraitBtn yy_setImageWithURL:[NSURL URLWithString:[LoginUtils getFaceImg]] forState:UIControlStateNormal placeholder:[UIImage imageNamed:@"portrait"]];
[self.portraitIV yy_setImageWithURL:[NSURL URLWithString:[LoginUtils getFaceImg]] placeholder:[UIImage imageNamed:@"portrait"]];
[self addSubview:self.userInfoTV];
[self addSubview:self.layoutBtn];
......@@ -77,33 +77,34 @@
// 用户头像上传成功后存入沙盒(暂不处理)
if (requestModel.resCode == DSResCodeSuccess) {
[DSProgressHUD showToast:@"修改成功"];
[self.portraitBtn setImage:croppedImage forState:UIControlStateNormal];
self.portraitIV.image = croppedImage;
[self.ds_viewController dismissViewControllerAnimated:YES completion:nil];
}
}];
}
#pragma mark - lazy
- (UIButton *)portraitBtn {
if (!_portraitBtn) {
- (UIImageView *)portraitIV {
if (!_portraitIV) {
CGFloat top = iPhone5 ? 40 : 83;
_portraitBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, top, 145, 145)];
_portraitBtn.centerX = self.centerX;
[_portraitBtn addTarget:self action:@selector(updatePortraitAction) forControlEvents:UIControlEventTouchUpInside];
_portraitBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
_portraitBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill;
_portraitBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
[_portraitBtn cornerRadius:145/2.0];
[self addSubview:_portraitBtn];
_portraitIV = [[UIImageView alloc] initWithFrame:CGRectMake(0, top, 145, 145)];
_portraitIV.centerX = self.centerX;
_portraitIV.userInteractionEnabled = YES;
_portraitIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, .5);
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(updatePortraitAction)];
[_portraitIV addGestureRecognizer:tapGR];
[_portraitIV cornerRadius:145/2.0];
[self addSubview:_portraitIV];
UIImageView *cameraIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cameraIcon"]];
cameraIV.dk_alphaPicker = DKAlphaPickerWithAlphas(1, .5, .5);
[self addSubview:cameraIV];
[cameraIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(_portraitBtn).offset(-6);
make.bottom.equalTo(_portraitBtn).offset(-6);
make.right.equalTo(_portraitIV).offset(-6);
make.bottom.equalTo(_portraitIV).offset(-6);
}];
}
return _portraitBtn;
return _portraitIV;
}
- (InfoModifyAlertView *)photoAlertView {
......@@ -115,7 +116,7 @@
- (UserInfoTableView *)userInfoTV {
if (!_userInfoTV) {
_userInfoTV = [[UserInfoTableView alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.portraitBtn.frame) + 60, kScreenWidth - 30, 150) style:UITableViewStylePlain];
_userInfoTV = [[UserInfoTableView alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.portraitIV.frame) + 60, kScreenWidth - 30, 150) style:UITableViewStylePlain];
}
return _userInfoTV;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!