add
This commit is contained in:
@@ -61,8 +61,6 @@
|
||||
-(void)updatePage{
|
||||
|
||||
self.pagControl.currentPage = self.scrollView.contentOffset.x / self.scrollView.bounds.size.width;
|
||||
|
||||
|
||||
self.pagControl.hidden = self.scrollView.contentOffset.x / self.scrollView.bounds.size.width == 2 ? YES : NO;
|
||||
GILog(@"%ld",self.pagControl.currentPage);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate,MaskTimeTextViewDelegate>
|
||||
{
|
||||
AVAudioPlayer *_musicPalyer;
|
||||
AVAudioPlayer *_startMaskMusic;
|
||||
}
|
||||
|
||||
@property (nonatomic,strong) UIButton *rightNavUserBtn;
|
||||
@@ -123,7 +124,6 @@
|
||||
return _hairImageView;
|
||||
}
|
||||
|
||||
|
||||
//人脸
|
||||
- (UIImageView *)faceView{
|
||||
if (!_faceView) {
|
||||
@@ -206,27 +206,28 @@
|
||||
|
||||
#pragma mark 弹幕
|
||||
-(void)createInputView{
|
||||
|
||||
|
||||
|
||||
GiGaFlingCommitVC* GiGaFlingVC = [[GiGaFlingCommitVC alloc] init];
|
||||
if (ISIOS8) {
|
||||
GiGaFlingVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
||||
}else{
|
||||
GiGaFlingVC.modalPresentationStyle = UIModalPresentationCurrentContext;
|
||||
}
|
||||
GiGaFlingVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
|
||||
GiGaFlingVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||
[self presentViewController:GiGaFlingVC animated:NO completion:nil];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - 生命周期
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
//取消导航对内容下移影响
|
||||
[self.navigationController.navigationBar setTranslucent:YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
||||
@@ -235,13 +236,12 @@
|
||||
|
||||
// app引导页
|
||||
|
||||
// BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
|
||||
// if (showAppGaurd == NO) {
|
||||
// [self showAPPappGaurdView];
|
||||
// }
|
||||
|
||||
//[self showAPPappGaurdView];
|
||||
BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
|
||||
if (showAppGaurd == NO) {
|
||||
[self showAPPappGaurdView];
|
||||
}
|
||||
|
||||
// [self showUserGaurdView];
|
||||
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
[self initUI];
|
||||
[self addNotify];
|
||||
[self creatBackGroundMusic];
|
||||
|
||||
[self creatMaskTimeSatrtMusic];
|
||||
}
|
||||
|
||||
#pragma mark - 响应事件
|
||||
@@ -315,7 +315,6 @@
|
||||
make.top.mas_equalTo(self.attachPoint.y - 87);
|
||||
}];
|
||||
|
||||
|
||||
[self.maskImageView setImage:[UIImage imageNamed:@"masking_img_mask"]];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
@@ -474,12 +473,28 @@
|
||||
NSError *payerError;
|
||||
NSURL *musicUrl = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"pomodoSound" ofType:@"m4a"]] ;
|
||||
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicUrl error:&payerError];
|
||||
player.numberOfLoops = 1;//-1 无限
|
||||
player.numberOfLoops = -1;//-1 无限
|
||||
player.volume = 0;
|
||||
_musicPalyer = player;
|
||||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||
//设置后台模式和锁屏模式下依然能够播放
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 开始面膜时间提示音🎵
|
||||
-(void)creatMaskTimeSatrtMusic{
|
||||
|
||||
//初始化音频播放器
|
||||
NSError *payerError;
|
||||
NSURL *musicUrl = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"ogg_btn" ofType:@"mp3"]] ;
|
||||
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicUrl error:&payerError];
|
||||
player.numberOfLoops = 2;
|
||||
player.volume = 0.5;
|
||||
|
||||
_startMaskMusic = player;
|
||||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||
//设置后台模式和锁屏模式下依然能够播放
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
||||
}
|
||||
|
||||
#pragma mark 开始面膜时间
|
||||
@@ -493,6 +508,7 @@
|
||||
return;
|
||||
}
|
||||
delegate.isMasking = YES;
|
||||
[_startMaskMusic play];
|
||||
[_musicPalyer play];
|
||||
// [self setBackGroundPlayingInfo];//锁屏音频信息
|
||||
|
||||
@@ -504,7 +520,7 @@
|
||||
//[self showWaringView];
|
||||
|
||||
//app 前台时收到本地通知showAlert 后台时通知提醒
|
||||
// [[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"本地推送" fireTimeInterval:timeInterVal alertAction:@"测试面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
|
||||
[[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"面膜时间闹钟" fireTimeInterval:timeInterVal alertAction:@"面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
|
||||
|
||||
}
|
||||
|
||||
@@ -566,6 +582,8 @@
|
||||
|
||||
#pragma mark 开始测试
|
||||
-(void)testBtnAcion:(UIButton *)btn{
|
||||
|
||||
|
||||
// NSDictionary *dic = @{
|
||||
// @"dryness":@"0.41",
|
||||
// @"drynessPercent":@"41%",
|
||||
@@ -630,7 +648,9 @@
|
||||
#pragma mark 新手引导蒙版消失
|
||||
-(void)guardViewDissmiss{
|
||||
|
||||
//[self showWaringView];
|
||||
self.swipeGaurdimagView.hidden = NO;
|
||||
self.startMaskButton.hidden = NO;
|
||||
[self showWaringView];
|
||||
|
||||
}
|
||||
|
||||
@@ -660,6 +680,8 @@
|
||||
#pragma mark 新手引导
|
||||
-(void)showUserGaurdView{
|
||||
|
||||
self.swipeGaurdimagView.hidden = YES;
|
||||
self.startMaskButton.hidden = YES;
|
||||
UserGuardViewController *userGuardVC = [[UserGuardViewController alloc] init];
|
||||
if (ISIOS8) {
|
||||
userGuardVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
||||
@@ -715,7 +737,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.navigationController.navigationBar.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
@@ -809,7 +830,6 @@
|
||||
if (user.headImgUrl && ![user.headImgUrl isKindOfClass:[NSNull class]] ) {
|
||||
[self refreshUserIcon:user.headImgUrl];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 去分享
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
#import "SHineLabel.h"
|
||||
|
||||
@interface UserGuardViewController ()
|
||||
|
||||
@property(nonatomic,strong) UIImageView *handimage;
|
||||
@property(nonatomic,strong) UIImageView *upimage;
|
||||
|
||||
@end
|
||||
|
||||
@@ -29,24 +31,39 @@
|
||||
|
||||
-(void)creatUI{
|
||||
|
||||
// UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
// //face
|
||||
// UIImageView *faceimage = [[UIImageView alloc] init];
|
||||
// faceimage.image = [UIImage imageNamed:@"bg_img_face"];
|
||||
// faceimage.contentMode = UIViewContentModeScaleAspectFit;
|
||||
// [self.view addSubview:faceimage];
|
||||
// [faceimage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
//
|
||||
// [dismisBtn setTitle:@"知道了" forState:UIControlStateNormal];
|
||||
// [dismisBtn setTintColor:[UIColor whiteColor]];
|
||||
// dismisBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
|
||||
// [dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
// [self.view addSubview:dismisBtn];
|
||||
//
|
||||
// [dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.mas_equalTo(100);
|
||||
// make.height.mas_equalTo(60);
|
||||
// make.size.mas_equalTo(CGSizeMake(99, 124));
|
||||
// make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
// make.top.mas_equalTo(self.view.mas_top).offset(200);
|
||||
// make.top.mas_equalTo(self.view.mas_top).offset(91);
|
||||
//
|
||||
// }];
|
||||
//
|
||||
// //mask
|
||||
// UIImageView *maskimage = [[UIImageView alloc] init];
|
||||
// maskimage.image = [UIImage imageNamed:@"mask_img_mask"];
|
||||
// maskimage.contentMode = UIViewContentModeScaleAspectFit;
|
||||
// [self.view addSubview:maskimage];
|
||||
// [maskimage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.size.mas_equalTo(CGSizeMake(72, 87));
|
||||
// make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
// make.top.mas_equalTo(self.view.mas_top).offset(254);
|
||||
//
|
||||
// }];
|
||||
|
||||
// UIView *holdbackView = [[UIView alloc] initWithFrame:self.view.bounds];
|
||||
// holdbackView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||
// [self.view addSubview:holdbackView];
|
||||
|
||||
//usergaurd_uphand
|
||||
UIImageView *upimage = [[UIImageView alloc] init];
|
||||
upimage.image = [UIImage imageNamed:@"userguard_up"];
|
||||
self.upimage = upimage;
|
||||
[self.view addSubview:upimage];
|
||||
[upimage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.and.with.mas_equalTo(20);
|
||||
@@ -85,6 +102,7 @@
|
||||
}];
|
||||
|
||||
// [self creatnaima];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -100,12 +118,22 @@
|
||||
make.top.mas_equalTo(201);
|
||||
|
||||
}];
|
||||
|
||||
[self->_upimage mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(201);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
[self->_handimage mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(301);
|
||||
|
||||
}];
|
||||
[self->_upimage mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(298);
|
||||
|
||||
}];
|
||||
[self.view layoutIfNeeded];
|
||||
}];
|
||||
|
||||
@@ -237,12 +237,15 @@
|
||||
if (index > _currentModel.answerList.count) {
|
||||
return;
|
||||
}
|
||||
|
||||
//答案整型非范围 设计稿范围展示!!
|
||||
NSLog(@"答案下标:%d",index);
|
||||
//修改答案默认下标
|
||||
|
||||
//返回时查看之前选中答案时使用
|
||||
_currentModel.slidervalue = value;
|
||||
//选中记录 修改答案默认下标 最终答案选择根据defaultFlag 1 时为选中答案
|
||||
[self changeAnswerDefaultflag:index];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -330,8 +333,6 @@
|
||||
-(void)reloadViews{
|
||||
|
||||
//刷新问题相关数据
|
||||
|
||||
|
||||
if (_page == self.questonArray.count) {
|
||||
|
||||
NSAttributedString *nextTitle = [[NSAttributedString alloc] initWithString:@"完成" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#import "UIButton+WebCache.h"
|
||||
#import "UIImageView+WebCache.h"
|
||||
#import "GiGaUserInfoVC.h"
|
||||
#import "LXCustomActionSheet.h"
|
||||
|
||||
@interface MaskTestResultVC ()
|
||||
|
||||
@@ -314,26 +315,48 @@
|
||||
[self showFinalShareView];
|
||||
UIImage *image = [UIImage saveNavsuitImage:self.tableView];
|
||||
//[[GiGaFileNanager shareInstance] saveImaeToAlBum:image];
|
||||
[self jxt_showActionSheetWithTitle:@"分享到微信" message:@"" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
|
||||
// [self jxt_showActionSheetWithTitle:@"分享到微信" message:@"" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
|
||||
//
|
||||
// alertMaker.addActionDefaultTitle(@"微信好友");
|
||||
// alertMaker.addActionDefaultTitle(@"朋友圈");
|
||||
// alertMaker.addActionCancelTitle(@"取消");
|
||||
// } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
|
||||
// [self hidSomeViews];
|
||||
// if (buttonIndex==0) {
|
||||
// //好友
|
||||
// [self shareImagToWX:image scene:WXSceneSession];
|
||||
//
|
||||
//
|
||||
// }else if (buttonIndex==1){
|
||||
// // 朋友圈
|
||||
// [self shareImagToWX:image scene:WXSceneTimeline];
|
||||
// }else{
|
||||
// GILog(@"取消");
|
||||
//
|
||||
// }
|
||||
// }];
|
||||
|
||||
LXCustomActionSheet *sheet = [[LXCustomActionSheet alloc] initWithTitle:@"分享到微信" optionsArr:@[@"微信好友",@"朋友圈"] cancelTitle:@"取消" selectedBlock:^(NSInteger index) {
|
||||
|
||||
alertMaker.addActionDefaultTitle(@"微信好友");
|
||||
alertMaker.addActionDefaultTitle(@"朋友圈");
|
||||
alertMaker.addActionCancelTitle(@"取消");
|
||||
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
|
||||
if (index==0) {
|
||||
[self hidSomeViews];
|
||||
//好友
|
||||
[self shareImagToWX:image scene:WXSceneSession];
|
||||
|
||||
|
||||
}else if (index==1){
|
||||
[self hidSomeViews];
|
||||
// 朋友圈
|
||||
[self shareImagToWX:image scene:WXSceneTimeline];
|
||||
}
|
||||
|
||||
} cancelBlock:^{
|
||||
[self hidSomeViews];
|
||||
if (buttonIndex==0) {
|
||||
//好友
|
||||
[self shareImagToWX:image scene:WXSceneSession];
|
||||
|
||||
|
||||
}else if (buttonIndex==1){
|
||||
// 朋友圈
|
||||
[self shareImagToWX:image scene:WXSceneTimeline];
|
||||
}else{
|
||||
GILog(@"取消");
|
||||
|
||||
}
|
||||
GILog(@"取消");
|
||||
}];
|
||||
|
||||
[sheet show];
|
||||
|
||||
}
|
||||
-(void)hidSomeViews{
|
||||
MaskResultShareViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
|
||||
@@ -350,8 +373,7 @@
|
||||
cell.shareBtn.hidden = YES;
|
||||
cell.lastLabe.text = @"长按扫描二维码,测试你的肤质";
|
||||
self.tabheader.hidden = NO;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)shareImagToWX:(UIImage *)image scene:(int)scene{
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
@property (nonatomic,assign) int answer_id;
|
||||
//默认答案 1选中 0 非选中
|
||||
@property (nonatomic,assign) int defaultFlag;
|
||||
//答案h序号
|
||||
@property (nonatomic,assign) int sortNum;
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSInteger,GIGaQuestionSliderType)
|
||||
{
|
||||
GIGaQuestionSliderTypeGray = 0,//灰
|
||||
GIGaQuestionSliderTypeGray = 0,//灰 //红
|
||||
GIGaQuestionSliderTypeGradient ,//变色
|
||||
GIGaQuestionSliderTypeIndicator //带指示器
|
||||
};
|
||||
|
||||
@@ -57,13 +57,14 @@
|
||||
}
|
||||
|
||||
-(void)creatGradient{
|
||||
|
||||
self.minimumTrackTintColor=[UIColor clearColor];
|
||||
self.maximumTrackTintColor=[UIColor clearColor];
|
||||
|
||||
NSArray *colorArr = @[(id)[[UIColor colorWithHex:0xFFFFFF] CGColor],
|
||||
(id)[[UIColor colorWithHex:0xFFF3E4] CGColor],
|
||||
(id)[[UIColor colorWithHex:0xFBC37B] CGColor]];
|
||||
NSArray *colorLocationArray = @[@0.0, @0.5, @1];
|
||||
NSArray *colorLocationArray = @[@0.0, @0.5, @1.0];
|
||||
CAGradientLayer * gradientLayer = [CAGradientLayer layer];
|
||||
gradientLayer.frame = self.bounds;
|
||||
gradientLayer.masksToBounds = YES;
|
||||
@@ -76,18 +77,21 @@
|
||||
[gradientLayer setStartPoint:CGPointMake(0, 0)];
|
||||
[gradientLayer setEndPoint:CGPointMake(1, 0)];
|
||||
[self.layer addSublayer:gradientLayer];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)createUI{
|
||||
|
||||
self.minimumValue = 0.0;
|
||||
self.maximumValue = 1.0;
|
||||
self.minimumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
self.maximumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
// self.minimumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
// self.maximumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
self.minimumTrackTintColor = GIGAUIColorFromRGBA(0xEA4D4D);
|
||||
self.maximumTrackTintColor = GIGAUIColorFromRGBA(0xEA4D4D);
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(CGRect)trackRectForBounds:(CGRect)bounds
|
||||
{
|
||||
bounds.origin.x = bounds.origin.x;
|
||||
@@ -95,6 +99,7 @@
|
||||
bounds.size.height = bounds.size.height;
|
||||
bounds.size.width = bounds.size.width;
|
||||
return bounds;
|
||||
|
||||
}
|
||||
|
||||
-(void)thumbimageView{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -49,6 +49,7 @@
|
||||
<connections>
|
||||
<outlet property="answerTitle" destination="iR5-Lj-9dP" id="Jlc-ce-rWZ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="137.59999999999999" y="148.42578710644679"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
||||
@@ -80,13 +80,15 @@
|
||||
-(void)creatPopSlider{
|
||||
|
||||
[self creatTab];
|
||||
NYSliderPopover *slider = [[NYSliderPopover alloc] init];
|
||||
slider.frame = CGRectMake(0,self.frame.size.height,self.frame.size.height, 13);
|
||||
NYSliderPopover *slider = [[NYSliderPopover alloc] initWithFrame:CGRectMake(0,self.frame.size.height,self.frame.size.height, 14)];
|
||||
// slider.frame = CGRectMake(0,self.frame.size.height,self.frame.size.height, 14);
|
||||
[slider addTarget:self action:@selector(updateValue:) forControlEvents:UIControlEventValueChanged];
|
||||
self.poSlider = slider;
|
||||
self.poSlider = slider;
|
||||
[self addSubview:slider];
|
||||
//self.poSlider.value = self.currentModel.slidervalue;
|
||||
self.poSlider.value = self.currentModel.slidervalue;
|
||||
self.poSlider.transform = CGAffineTransformMakeRotation(- M_PI/2);
|
||||
//NSLog(@"popslider%@",self.poSlider);
|
||||
|
||||
}
|
||||
|
||||
-(void)creatNormalStyle:(NSArray *)titles style:(GIGaQuestionSliderType)type{
|
||||
@@ -96,12 +98,13 @@
|
||||
|
||||
-(void)creatSliderType:(GIGaQuestionSliderType)type{
|
||||
|
||||
GIGaQuestionSlider *slider = [[GIGaQuestionSlider alloc] initWithFrame:CGRectMake(0,self.frame.size.height,self.frame.size.height, 13) type:type];
|
||||
GIGaQuestionSlider *slider = [[GIGaQuestionSlider alloc] initWithFrame:CGRectMake(0,self.frame.size.height,self.frame.size.height, 14) type:type];
|
||||
[slider addTarget:self action:@selector(updateValue:) forControlEvents:UIControlEventValueChanged];
|
||||
self.slider = slider;
|
||||
[self.slider setValue:self.currentModel.slidervalue];
|
||||
[self addSubview:slider];
|
||||
self.slider.transform = CGAffineTransformMakeRotation(- M_PI/2);
|
||||
|
||||
}
|
||||
|
||||
-(void)layoutSubviews{
|
||||
@@ -145,9 +148,9 @@
|
||||
|
||||
[self selectNOBtnState:self.noBtn];
|
||||
}else{
|
||||
|
||||
[self selctYesBtnState:self.yesBtn];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 是
|
||||
@@ -192,8 +195,40 @@
|
||||
|
||||
-(void)updateValue:(UISlider *)slider{
|
||||
NSLog(@"value%f",slider.value);
|
||||
// 2 ,3 ,5 题slider 滑动时自动滑动到答案
|
||||
|
||||
if (self.poSlider) {
|
||||
//1 范围匹配取值
|
||||
[self anlysisAnswerWithSlider:slider.value];
|
||||
}else{
|
||||
// 2 ,3 ,5 题slider 滑动时自动滑动到答案
|
||||
// 范围0 ~ 100
|
||||
//每一份高度
|
||||
NSInteger totalCount = _answerList.count;
|
||||
CGFloat powSize = 100.f / (totalCount -1);
|
||||
//当前值
|
||||
CGFloat currentValue = slider.value * 100.f;
|
||||
//答案游标
|
||||
int count = currentValue / powSize;
|
||||
//最终自动滑到答案slider对应的value
|
||||
int index = 0 ;
|
||||
index = (int)_answerList.count - 1 -count;
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
NSLog(@"%d",index);
|
||||
float value = 1.f/(totalCount -1) * count;
|
||||
NSLog(@"%f",value);
|
||||
[self anlysisAnswerWithSlider:value];
|
||||
[self sliderAutoChoiceAnswerValue:value];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[self anlysisAnswerWithSlider:slider.value];
|
||||
-(void)sliderAutoChoiceAnswerValue:(float)value{
|
||||
|
||||
[self.slider setValue:value];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 题目答案解析
|
||||
@@ -228,7 +263,7 @@
|
||||
//答案游标 1开始
|
||||
int count = currentValue / powSize;
|
||||
|
||||
//答案数组下标
|
||||
//答案数组下标 与slider值逆序对应(slider 0 对应 数组最大下标)
|
||||
int index = 0 ;
|
||||
index = (int)_answerList.count - 1 -count;
|
||||
if (index < 0) {
|
||||
|
||||
@@ -23,8 +23,18 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
|
||||
[self thumbimageView];
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self thumbimageView];
|
||||
[self createUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -34,16 +44,15 @@
|
||||
|
||||
- (NYPopover *)popover
|
||||
{
|
||||
if (_popover == nil) {
|
||||
if (_popover == nil){
|
||||
//Default size, can be changed after
|
||||
[self addTarget:self action:@selector(updatePopoverFrame) forControlEvents:UIControlEventValueChanged];
|
||||
_popover = [[NYPopover alloc] initWithFrame:CGRectMake(self.frame.origin.x, self.frame.origin.y - 32, 40, 32)];
|
||||
[self updatePopoverFrame];
|
||||
_popover.alpha = 0;
|
||||
[self.superview addSubview:_popover];
|
||||
|
||||
[self thumbimageView];
|
||||
[self createUI];
|
||||
// [self thumbimageView];
|
||||
// [self createUI];
|
||||
}
|
||||
|
||||
return _popover;
|
||||
@@ -52,7 +61,8 @@
|
||||
- (void)setValue:(float)value
|
||||
{
|
||||
[super setValue:value];
|
||||
[self updatePopoverFrame];
|
||||
//[self updatePopoverFrame];
|
||||
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
@@ -157,8 +167,10 @@
|
||||
|
||||
self.minimumValue = 0.0;
|
||||
self.maximumValue = 1.0;
|
||||
self.minimumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
self.maximumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
// self.minimumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
// self.maximumTrackTintColor = GIGARGB(216,216, 216, 1);
|
||||
self.minimumTrackTintColor = GIGAUIColorFromRGBA(0xEA4D4D);
|
||||
self.maximumTrackTintColor = GIGAUIColorFromRGBA(0xEA4D4D);
|
||||
|
||||
}
|
||||
|
||||
@@ -171,6 +183,8 @@
|
||||
return bounds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)thumbimageView{
|
||||
|
||||
[self setThumbImage:[self OriginImage:[UIImage imageNamed:@"btn_slider_thumb"] scaleToSize:CGSizeMake(40, 40)] forState:UIControlStateNormal];
|
||||
@@ -236,7 +250,6 @@
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,17 @@ typedef NS_ENUM(NSUInteger, GYTitlePosition) {
|
||||
weakSelf.textLabel.layer.position = weakSelf.bottomPosition;
|
||||
weakSelf.needDealy = DEALY_WHEN_TITLE_IN_BOTTOM;
|
||||
weakSelf.currentIndex ++;
|
||||
weakSelf.textLabel.text = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
|
||||
NSString *tex = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
|
||||
if ([tex isEqualToString:@"面膜时间"]) {
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(18);
|
||||
}else{
|
||||
if (KMainW < 375) {
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(10);
|
||||
}else{
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(12);
|
||||
}
|
||||
}
|
||||
weakSelf.textLabel.text = tex;
|
||||
} else {
|
||||
weakSelf.needDealy = DEALY_WHEN_TITLE_IN_MIDDLE;
|
||||
}
|
||||
@@ -96,7 +106,17 @@ typedef NS_ENUM(NSUInteger, GYTitlePosition) {
|
||||
[weakSelf startAnimation];
|
||||
} else { //停止动画后,要设置label位置和label显示内容
|
||||
weakSelf.textLabel.layer.position = weakSelf.middlePosition;
|
||||
weakSelf.textLabel.text = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
|
||||
NSString *tex = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
|
||||
if ([tex isEqualToString:@"面膜时间"]) {
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(18);
|
||||
}else{
|
||||
if (KMainW < 375) {
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(10);
|
||||
}else{
|
||||
weakSelf.textLabel.font = GIGA_TEXTFONTMEDIUM(12);
|
||||
}
|
||||
}
|
||||
weakSelf.textLabel.text = tex;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user