141 lines
5.6 KiB
Mathematica
141 lines
5.6 KiB
Mathematica
|
|
//
|
|||
|
|
// BottleShaiXuanCellView.m
|
|||
|
|
// TreeHole
|
|||
|
|
//
|
|||
|
|
// Created by 郑创权 on 2022/10/7.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import "BottleShaiXuanCellView.h"
|
|||
|
|
@interface BottleShaiXuanCellView()
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong)UILabel* titleLab;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
|
|||
|
|
@implementation BottleShaiXuanCellView
|
|||
|
|
|
|||
|
|
-(instancetype)initWithFrame:(CGRect)frame{
|
|||
|
|
self = [super initWithFrame:frame];
|
|||
|
|
if (self) {
|
|||
|
|
[self addSubview:self.titleLab];
|
|||
|
|
}
|
|||
|
|
return self;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
-(UILabel *)titleLab{
|
|||
|
|
if (!_titleLab) {
|
|||
|
|
_titleLab = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, 70, 22)];
|
|||
|
|
_titleLab.textAlignment = NSTextAlignmentLeft;
|
|||
|
|
_titleLab.textColor = COLOR_WITH_RGB(0xFFFFFF);
|
|||
|
|
_titleLab.font = MT_FONT_MEDIUM_NO_SCALE_SIZE(16);
|
|||
|
|
}
|
|||
|
|
return _titleLab;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
-(void)setTitleStr:(NSString *)titleStr{
|
|||
|
|
_titleStr = titleStr;
|
|||
|
|
_titleLab.text = _titleStr;
|
|||
|
|
if ([_titleStr isEqualToString:@"高级筛选"]) {
|
|||
|
|
// UIImageView* vipTagImgV = [[UIImageView alloc]initWithFrame:CGRectMake(_titleLab.right + 3, 5, 12, 12)];
|
|||
|
|
// vipTagImgV.contentMode = UIViewContentModeScaleAspectFill;
|
|||
|
|
// vipTagImgV.image = [UIImage imageNamed:@"vip_tag"];
|
|||
|
|
// [self addSubview:vipTagImgV];
|
|||
|
|
UIView* nianVipView = [[UIView alloc]initWithFrame:CGRectMake(_titleLab.right + 8, (_titleLab.height - 16)/2.0, 34, 16)];
|
|||
|
|
nianVipView.layer.cornerRadius = 8;
|
|||
|
|
nianVipView.layer.masksToBounds = YES;
|
|||
|
|
// gradient
|
|||
|
|
CAGradientLayer *gl = [CAGradientLayer layer];
|
|||
|
|
gl.frame = CGRectMake(0,0,nianVipView.width,nianVipView.height);
|
|||
|
|
gl.startPoint = CGPointMake(0, 0.5);
|
|||
|
|
gl.endPoint = CGPointMake(1, 0.5);
|
|||
|
|
gl.colors = @[(__bridge id)HEX_COLOR(0xE4B18B).CGColor, (__bridge id)HEX_COLOR(0xFFF4EC).CGColor, (__bridge id)HEX_COLOR(0xE4B18B).CGColor];
|
|||
|
|
gl.locations = @[@(0), @(0.5f), @(1.0f)];
|
|||
|
|
[nianVipView.layer addSublayer:gl];
|
|||
|
|
UILabel* nianVipLab = [[UILabel alloc]initWithFrame:nianVipView.bounds];
|
|||
|
|
nianVipLab.text = @"年VIP";
|
|||
|
|
nianVipLab.textColor = HEX_COLOR(0x000000);
|
|||
|
|
nianVipLab.textAlignment = NSTextAlignmentCenter;
|
|||
|
|
nianVipLab.font = MT_FONT_MEDIUM_SIZE(10);
|
|||
|
|
[nianVipView addSubview:nianVipLab];
|
|||
|
|
// [nianVipLab bringSubviewToFront:nianVipLab.text];
|
|||
|
|
[self addSubview:nianVipView];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
-(void)setSelectContentArray:(NSArray *)selectContentArray{
|
|||
|
|
_selectContentArray = selectContentArray;
|
|||
|
|
for (NSInteger i = 0; i < _selectContentArray.count; i++) {
|
|||
|
|
UIButton*selectContentBtn = [[UIButton alloc]initWithFrame:CGRectMake(20 + (60+16)*i,_titleLab.bottom + 15, 60, 26)];
|
|||
|
|
selectContentBtn.tag = 400001+i;
|
|||
|
|
[selectContentBtn setTitle:_selectContentArray[i] forState:UIControlStateNormal];
|
|||
|
|
[selectContentBtn setTitleColor:COLOR_WITH_RGB(0xFFFFFF) forState:UIControlStateNormal];
|
|||
|
|
selectContentBtn.titleLabel.font = MT_FONT_MEDIUM_NO_SCALE_SIZE(14);
|
|||
|
|
selectContentBtn.backgroundColor = COLOR_WITH_RGB_A(0xFFFFFF, 0.2);
|
|||
|
|
selectContentBtn.layer.borderWidth = 1;
|
|||
|
|
selectContentBtn.layer.cornerRadius = 4;
|
|||
|
|
NSDictionary* dataDict = [[NSUserDefaults standardUserDefaults]objectForKey:@"UserNearbyShaiXuanDict"];
|
|||
|
|
NSString* markStr = @"";
|
|||
|
|
if ([_titleStr isEqualToString:@"TA的属性"]) {
|
|||
|
|
markStr = dataDict[@"sx_gender"];
|
|||
|
|
}
|
|||
|
|
if ([_titleStr isEqualToString:@"TA的年龄"]) {
|
|||
|
|
markStr = dataDict[@"sx_age"];
|
|||
|
|
}
|
|||
|
|
if ([_titleStr isEqualToString:@"高级筛选"]) {
|
|||
|
|
markStr = dataDict[@"sx_gjsx"];
|
|||
|
|
}
|
|||
|
|
if ([_selectContentArray[i] isEqualToString:markStr] ) {
|
|||
|
|
selectContentBtn.layer.borderColor = COLOR_WITH_RGB(0xFFB902).CGColor;
|
|||
|
|
selectContentBtn.selected = YES;
|
|||
|
|
}else{
|
|||
|
|
selectContentBtn.layer.borderColor = COLOR_WITH_RGB(0x292247).CGColor;
|
|||
|
|
selectContentBtn.selected = NO;
|
|||
|
|
}
|
|||
|
|
[selectContentBtn addTarget:self action:@selector(selectContentBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
[self addSubview:selectContentBtn];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
-(void)selectContentBtnClick:(UIButton*)sender{
|
|||
|
|
if (sender.isSelected) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// if ([_titleStr isEqualToString:@"TA的属性"]) {
|
|||
|
|
// if(![UserService currentUser].isVIP){
|
|||
|
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
// [SVProgressHUD showErrorWithStatus:@"选择Ta的属性是VIP的专属特权,开通才能使用哦~"];
|
|||
|
|
// });
|
|||
|
|
// [PYAppService showVipVC:@"vip_page"];
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
if ([_titleStr isEqualToString:@"高级筛选"]) {
|
|||
|
|
if ([UserService currentUser].vip_kind != 10) {
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
[SVProgressHUD showErrorWithStatus:@"高级筛选是年VIP的专属特权,开通才能使用哦~"];
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
[PYAppService showVipVC:@"vip_page"];
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (NSInteger i = 0; i < _selectContentArray.count; i++) {
|
|||
|
|
UIButton*selectContentBtn = (UIButton*)[self viewWithTag:400001+i];
|
|||
|
|
if (selectContentBtn == sender) {
|
|||
|
|
selectContentBtn.selected = YES;
|
|||
|
|
selectContentBtn.layer.borderColor = COLOR_WITH_RGB(0xFFB902).CGColor;
|
|||
|
|
}else{
|
|||
|
|
selectContentBtn.selected = NO;
|
|||
|
|
selectContentBtn.layer.borderColor = COLOR_WITH_RGB(0x292247).CGColor;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
!self.selectContentStrBlockClick?:self.selectContentStrBlockClick(_titleStr,sender.titleLabel.text);
|
|||
|
|
}
|
|||
|
|
@end
|