app年龄,星座,寻爱飘屏优化
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
///id
|
||||
@property (nonatomic,strong) UILabel *idLabel;
|
||||
///性别
|
||||
@property (nonatomic,strong) UIImageView *sexImageView;
|
||||
@property (nonatomic,strong) UIButton *sexImageView;
|
||||
///星座
|
||||
@property(nonatomic,strong) UIImageView *starVeiw;
|
||||
|
||||
@@ -118,8 +118,12 @@
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
[self.starVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(47);
|
||||
make.height.mas_equalTo(17);
|
||||
make.width.mas_equalTo(46);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(28);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nobleImageView);
|
||||
@@ -213,35 +217,7 @@
|
||||
return day;
|
||||
}
|
||||
|
||||
- (NSString *)calculateConstellationWithMonth:(long)time
|
||||
{
|
||||
NSString *astroString = YMLocalizedString(@"XPMineHeadView0");
|
||||
NSString *astroFormat = @"102123444543";
|
||||
NSString *result;
|
||||
|
||||
NSInteger month = [self getMonth:time];
|
||||
NSInteger day = [self getDay:time];
|
||||
|
||||
if (month<1 || month>12 || day<1 || day>31){
|
||||
return YMLocalizedString(@"XPMineHeadView1");
|
||||
}
|
||||
|
||||
if(month==2 && day>29)
|
||||
{
|
||||
return YMLocalizedString(@"XPMineHeadView2");
|
||||
}else if(month==4 || month==6 || month==9 || month==11) {
|
||||
if (day>30) {
|
||||
return YMLocalizedString(@"XPMineHeadView3");
|
||||
}
|
||||
}
|
||||
|
||||
result=[NSString stringWithFormat:@"%@",[astroString substringWithRange:NSMakeRange(month*2-(day < [[astroFormat substringWithRange:NSMakeRange((month-1), 1)] intValue] - (-19))*2,2)]];
|
||||
NSDictionary *starDic = @{YMLocalizedString(@"XPMineHeadView9"):@"pi_capricorn",YMLocalizedString(@"XPMineHeadView10"):@"pi_water_bottle",YMLocalizedString(@"XPMineHeadView11"):@"pi_pisces",YMLocalizedString(@"XPMineHeadView12"):@"pi_aries",YMLocalizedString(@"XPMineHeadView13"):@"pi_taurus",YMLocalizedString(@"XPMineHeadView14"):@"pi_gemini",YMLocalizedString(@"XPMineHeadView15"):@"pi_cancer",YMLocalizedString(@"XPMineHeadView16"):@"pi_lion",YMLocalizedString(@"XPMineHeadView17"):@"pi_virgin",YMLocalizedString(@"XPMineHeadView18"):@"pi_libra",YMLocalizedString(@"XPMineHeadView19"):@"pi_scorpion",YMLocalizedString(@"XPMineHeadView20"):@"pi_shooter"};
|
||||
|
||||
|
||||
|
||||
return starDic[result];
|
||||
}
|
||||
|
||||
/// 生成一个图片的富文本
|
||||
/// @param imageUrl 网络图片的地址
|
||||
@@ -278,20 +254,7 @@
|
||||
return attribute;
|
||||
}
|
||||
|
||||
//dateLabel
|
||||
- (NSMutableAttributedString *)makeDateLabel:(long)birth{
|
||||
NSString *dateStr = [NSString stringWithFormat:@" %@ ",[self calculateConstellationWithMonth:birth]];
|
||||
UIButton *dataButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[dataButton setTitle:dateStr forState:UIControlStateNormal];
|
||||
dataButton.titleLabel.font = [UIFont boldSystemFontOfSize:10];
|
||||
[dataButton setTitleColor:UIColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
|
||||
dataButton.frame = CGRectMake(0, 0, 45, 17);
|
||||
dataButton.layer.masksToBounds = YES;
|
||||
dataButton.layer.cornerRadius = 17/2;
|
||||
[dataButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
NSMutableAttributedString * dateLabelString = [NSMutableAttributedString yy_attachmentStringWithContent:dataButton contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(dataButton.frame.size.width, dataButton.frame.size.height) alignToFont:[UIFont systemFontOfSize:11] alignment:YYTextVerticalAlignmentCenter];
|
||||
return dateLabelString;
|
||||
}
|
||||
|
||||
|
||||
///铭牌
|
||||
- (NSMutableAttributedString *)createNameplateAttibute:(NSString *)tagName image:(NSString *)imageName textFont:(UIFont *)textFont {
|
||||
@@ -425,14 +388,17 @@
|
||||
make.left.mas_equalTo(self.nobleImageView.mas_right);
|
||||
}];
|
||||
}
|
||||
NSString * sexName;
|
||||
if (userInfo.gender == GenderType_Male) {
|
||||
sexName = @"common_male";
|
||||
} else {
|
||||
sexName = @"common_female";
|
||||
}
|
||||
self.starVeiw.text = [NSString stringWithFormat:@" %@ ",[self calculateConstellationWithMonth:_userInfo.birth]];
|
||||
self.sexImageView.image = [UIImage imageNamed:sexName];
|
||||
|
||||
NSString *starImage = [NSString
|
||||
getCalculateConstellationImageWithMonth:_userInfo.birth];
|
||||
if(starImage.length > 0){
|
||||
self.starVeiw.image = kImage(starImage);
|
||||
}
|
||||
|
||||
|
||||
[self.sexImageView setTitle:[NSString getAgeWithBirth:userInfo.birth] forState:UIControlStateNormal];
|
||||
self.sexImageView.hidden = NO;
|
||||
self.sexImageView.backgroundColor = userInfo.gender == GenderType_Male ? UIColorFromRGB(0x6BB3FF) :UIColorFromRGB(0xFF80CC);
|
||||
self.levelLabel.attributedText = _userInfo.levelAtt;
|
||||
self.fansView.number = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
|
||||
self.attentionView.number = [NSString stringWithFormat:@"%ld",_userInfo.followNum];
|
||||
@@ -510,10 +476,18 @@
|
||||
return _idLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)sexImageView {
|
||||
- (UIButton *)sexImageView {
|
||||
if (!_sexImageView) {
|
||||
_sexImageView = [[UIImageView alloc] init];
|
||||
_sexImageView.userInteractionEnabled = YES;
|
||||
_sexImageView = [[UIButton alloc] init];
|
||||
[_sexImageView setImage:kImage(@"home_age_boy_icon") forState:UIControlStateNormal];
|
||||
[_sexImageView setImage:kImage(@"home_age_girl_icon") forState:UIControlStateSelected];
|
||||
_sexImageView.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
|
||||
[_sexImageView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_sexImageView.imageEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 0);
|
||||
_sexImageView.layer.cornerRadius = 14/2;
|
||||
_sexImageView.layer.masksToBounds = YES;
|
||||
_sexImageView.hidden = YES;
|
||||
|
||||
}
|
||||
return _sexImageView;
|
||||
}
|
||||
|
Reference in New Issue
Block a user