
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
66 lines
1.8 KiB
Objective-C
66 lines
1.8 KiB
Objective-C
//
|
|
// SexAgeLabel.m
|
|
// YuMi
|
|
//
|
|
// Created by P on 2024/12/11.
|
|
//
|
|
|
|
#import "SexAgeLabel.h"
|
|
|
|
@interface SexAgeLabel ()
|
|
|
|
@property(nonatomic, strong) UIView *pillBackground;
|
|
@property(nonatomic, strong) UIImageView *sexImageView;
|
|
@property(nonatomic, strong) UILabel *ageLabel;
|
|
|
|
@end
|
|
|
|
@implementation SexAgeLabel
|
|
|
|
- (instancetype)init {
|
|
if (self = [super init]) {
|
|
|
|
// self.frame = CGRectMake(0, 0, 35, 16);
|
|
|
|
[self setCornerRadius:8];
|
|
[self addGradientBackgroundWithColors:@[[UIColor redColor], [UIColor blueColor]] startPoint:CGPointMake(0.5, 0) endPoint:CGPointMake(0.5, 1) cornerRadius:8];
|
|
|
|
[self addSubview:self.sexImageView];
|
|
[self addSubview:self.ageLabel];
|
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self);
|
|
make.leading.mas_equalTo(2);
|
|
make.width.height.mas_equalTo(8);
|
|
}];
|
|
|
|
[self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self);
|
|
make.leading.mas_equalTo(self.sexImageView.mas_trailing).offset(2);
|
|
make.trailing.mas_equalTo(-2);
|
|
}];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)updateSex:(BOOL)isMale age:(NSInteger)age {
|
|
self.sexImageView.image = isMale ? kImage(@"session_user_sex_male") : kImage(@"session_user_sex_female");
|
|
self.ageLabel.text = @(age).stringValue;
|
|
}
|
|
|
|
- (UIImageView *)sexImageView {
|
|
if (!_sexImageView) {
|
|
_sexImageView = [[UIImageView alloc] init];
|
|
_sexImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _sexImageView;
|
|
}
|
|
|
|
- (UILabel *)ageLabel {
|
|
if (!_ageLabel) {
|
|
_ageLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(12) textColor:[UIColor whiteColor]];
|
|
}
|
|
return _ageLabel;
|
|
}
|
|
|
|
@end
|