cdts/xdts-ios 3/TreeHole/Code/Features/Profile/View/BigUserImgAlertView.m
2023-07-27 09:20:00 +08:00

49 lines
1.2 KiB
Objective-C

//
// BigUserImgAlertView.m
// TreeHole
//
// Created by 郑创权 on 2022/11/17.
//
#import "BigUserImgAlertView.h"
@interface BigUserImgAlertView()
@property (nonatomic, strong)UIImageView* userImgV;
@end
@implementation BigUserImgAlertView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = HEX_COLOR_A(0x000000, 0.6);
[self addSubview:self.userImgV];
self.userImgV.transform = CGAffineTransformMakeScale(0.1, 0.1);
[UIView animateWithDuration:0.4 animations:^{
self.userImgV.transform = CGAffineTransformMakeScale(1, 1);
} completion:^(BOOL finished) {
}];
}
return self;
}
-(UIImageView *)userImgV{
if (!_userImgV) {
_userImgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, (SCREEN_HEIGHT - SCREEN_WIDTH)/2.0 - FIX_SIZE(60), SCREEN_WIDTH, SCREEN_WIDTH)];
_userImgV.contentMode = UIViewContentModeScaleToFill;
}
return _userImgV;
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self removeFromSuperview];
}
-(void)setUserImg:(UIImage *)userImg{
_userImg = userImg;
_userImgV.image = _userImg;
}
@end