add
This commit is contained in:
@@ -8,14 +8,19 @@
|
||||
|
||||
#import "GIGaQuestionSlider.h"
|
||||
#import "UIColor+HexColor.h"
|
||||
#define thumbBound_x 10
|
||||
#define thumbBound_y 20
|
||||
|
||||
@interface GIGaQuestionSlider()
|
||||
|
||||
{
|
||||
CGRect _lastBounds;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GIGaQuestionSlider
|
||||
|
||||
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame type:(GIGaQuestionSliderType)type
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
@@ -112,5 +117,53 @@
|
||||
|
||||
}
|
||||
|
||||
// 扩大thumb 触控区域
|
||||
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value
|
||||
|
||||
{
|
||||
rect.origin.x = rect.origin.x;
|
||||
rect.size.width = rect.size.width ;
|
||||
CGRect result = [super thumbRectForBounds:bounds trackRect:rect value:value];
|
||||
|
||||
_lastBounds = result;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
|
||||
|
||||
UIView *result = [super hitTest:point withEvent:event];
|
||||
|
||||
if (point.x < 0 || point.x > self.bounds.size.width){
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
if ((point.y >= -thumbBound_y) && (point.y < _lastBounds.size.height + thumbBound_y)) {
|
||||
float value = 0.0;
|
||||
value = point.x - self.bounds.origin.x;
|
||||
value = value/self.bounds.size.width;
|
||||
|
||||
value = value < 0? 0 : value;
|
||||
value = value > 1? 1: value;
|
||||
|
||||
value = value * (self.maximumValue - self.minimumValue) + self.minimumValue;
|
||||
[self setValue:value animated:YES];
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
|
||||
BOOL result = [super pointInside:point withEvent:event];
|
||||
if (!result && point.y > -10) {
|
||||
if ((point.x >= _lastBounds.origin.x - thumbBound_x) && (point.x <= (_lastBounds.origin.x + _lastBounds.size.width + thumbBound_x)) && (point.y < (_lastBounds.size.height + thumbBound_y))) {
|
||||
result = YES;
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MaskResultCandView : UIView
|
||||
@property(nonatomic,strong) UIImageView *shuiImageView;
|
||||
@property(nonatomic,strong) UIImageView *meibaiImageView;
|
||||
@property(nonatomic,strong) UIImageView *tilaImageView;
|
||||
@property(nonatomic,strong) NSArray *imagesArr;
|
||||
- (instancetype)initWith:(NSArray *)images;
|
||||
-(void)updateImages:(NSArray *)images;
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,7 +24,17 @@
|
||||
-(void)creatSubs{
|
||||
|
||||
for (NSInteger i=0; i<self.imagesArr.count; i ++) {
|
||||
|
||||
UIImageView *image = [[UIImageView alloc] init];
|
||||
|
||||
if (i==0) {
|
||||
self.shuiImageView = image;
|
||||
}else if (i==1){
|
||||
self.meibaiImageView = image;
|
||||
}else if (i==2){
|
||||
self.tilaImageView= image;
|
||||
}
|
||||
|
||||
image.contentMode = UIViewContentModeScaleAspectFill;
|
||||
image.image = [UIImage imageNamed:self.imagesArr[i]];
|
||||
image.layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
@@ -50,4 +60,19 @@
|
||||
|
||||
//[self creatSubs];
|
||||
}
|
||||
|
||||
-(void)updateImages:(NSArray *)images
|
||||
{
|
||||
for (NSInteger i=0; i<images.count; i++) {
|
||||
if (i==0) {
|
||||
self.shuiImageView.image = [UIImage imageNamed:images[i]];
|
||||
}else if (i==1){
|
||||
self.meibaiImageView.image = [UIImage imageNamed:images[i]];
|
||||
}else{
|
||||
self.tilaImageView.image = [UIImage imageNamed:images[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -91,9 +91,11 @@
|
||||
|
||||
}];
|
||||
|
||||
[self bringSubviewToFront:jianyiLabel];
|
||||
[self bringSubviewToFront:timeLabel];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)layoutSubviews{
|
||||
[super layoutSubviews];
|
||||
[self drawViewInView:self.colorView backColor:GIGA_MAIN_BGCOLOR];
|
||||
@@ -122,11 +124,15 @@
|
||||
}
|
||||
|
||||
-(void)loadMineWith:(NSString *)minute{
|
||||
|
||||
if ([minute isKindOfClass:[NSNull class]]) {
|
||||
minute = @"17";
|
||||
}
|
||||
NSString *time = [NSString stringWithFormat:@"%@分钟",minute];
|
||||
self.timeLabel.text = time;
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)laoutSettings{
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,13 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MaskTestResult.h"
|
||||
#import "MaskResultCandView.h"
|
||||
@interface MaskResultShareViewCell : UITableViewCell
|
||||
@property (nonatomic,strong) UIButton *shareBtn;
|
||||
-(void)kidTitle:(NSString *)title;
|
||||
@property (nonatomic,strong) MaskResultCandView *imagsBackView;
|
||||
|
||||
-(void)kidTitle:(MaskTestResult *)model;
|
||||
@property (nonatomic,strong) UILabel *candLabe;
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
}];
|
||||
//小图标
|
||||
NSArray * imagesArr = @[@"result_water",@"result_moon",@"result_push"];
|
||||
|
||||
MaskResultCandView *imagsBackView = [[MaskResultCandView alloc] initWith:imagesArr];
|
||||
self.imagsBackView = imagsBackView;
|
||||
[self addSubview:imagsBackView];
|
||||
|
||||
[imagsBackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -114,11 +116,19 @@
|
||||
|
||||
}
|
||||
|
||||
-(void)kidTitle:(NSString *)title{
|
||||
if (!title || [title isEqualToString:@""] || [title isKindOfClass:[NSNull class]]) {
|
||||
title = @"全效型";
|
||||
-(void)kidTitle:(MaskTestResult *)model{
|
||||
if (!model.mask || [model.mask isEqualToString:@""] || [model.mask isKindOfClass:[NSNull class]]) {
|
||||
model.mask = @"全效型";
|
||||
}
|
||||
self.candLabe.text = title;
|
||||
self.candLabe.text = model.mask;
|
||||
|
||||
NSString *water = model.moisture ==1 ? @"result_water":@"result_wmz";
|
||||
|
||||
NSString *meibai = model.whitening ==1 ? @"result_moon":@"result_ylwmz";
|
||||
|
||||
NSString *tila= model.liftingTightening ==1 ? @"result_push":@"result_wmzzz";
|
||||
|
||||
[self.imagsBackView updateImages:@[water,meibai,tila]];
|
||||
|
||||
}
|
||||
-(void)layoutSubviews{
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
|
||||
#import "NYSliderPopover.h"
|
||||
#import "NYPopover.h"
|
||||
#define thumbBound_x 10
|
||||
#define thumbBound_y 20
|
||||
|
||||
@interface NYSliderPopover()
|
||||
{
|
||||
CGRect _lastBounds;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NYSliderPopover
|
||||
|
||||
@@ -183,4 +191,55 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 扩大thumb 触控区域
|
||||
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value
|
||||
|
||||
{
|
||||
rect.origin.x = rect.origin.x;
|
||||
rect.size.width = rect.size.width ;
|
||||
CGRect result = [super thumbRectForBounds:bounds trackRect:rect value:value];
|
||||
|
||||
_lastBounds = result;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
|
||||
|
||||
UIView *result = [super hitTest:point withEvent:event];
|
||||
|
||||
if (point.x < 0 || point.x > self.bounds.size.width){
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
if ((point.y >= -thumbBound_y) && (point.y < _lastBounds.size.height + thumbBound_y)) {
|
||||
float value = 0.0;
|
||||
value = point.x - self.bounds.origin.x;
|
||||
value = value/self.bounds.size.width;
|
||||
|
||||
value = value < 0? 0 : value;
|
||||
value = value > 1? 1: value;
|
||||
|
||||
value = value * (self.maximumValue - self.minimumValue) + self.minimumValue;
|
||||
[self setValue:value animated:YES];
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
|
||||
BOOL result = [super pointInside:point withEvent:event];
|
||||
if (!result && point.y > -10) {
|
||||
if ((point.x >= _lastBounds.origin.x - thumbBound_x) && (point.x <= (_lastBounds.origin.x + _lastBounds.size.width + thumbBound_x)) && (point.y < (_lastBounds.size.height + thumbBound_y))) {
|
||||
result = YES;
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user