add 题目

This commit is contained in:
lianxiang
2018-09-11 23:05:15 +08:00
parent 86f8824e14
commit a2de9505ee
25 changed files with 711 additions and 136 deletions
+34
View File
@@ -70,6 +70,10 @@
836EE5D42136454500F0ABB2 /* RegistGetSMSCodeRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D32136454500F0ABB2 /* RegistGetSMSCodeRequest.m */; };
836EE5D7213645E300F0ABB2 /* GiGaBaseAPiRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */; };
836EE5DA2136716100F0ABB2 /* NSTimer+Convenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */; };
83773FBC214769230014EE4C /* ExercisesModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 83773FBB214769230014EE4C /* ExercisesModel.m */; };
83773FBF214791E10014EE4C /* GIGaQuestionSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 83773FBE214791E10014EE4C /* GIGaQuestionSlider.m */; };
83773FC221479FED0014EE4C /* UIColor+HexColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 83773FC121479FED0014EE4C /* UIColor+HexColor.m */; };
83773FC52147A5CC0014EE4C /* MaskQuestionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83773FC42147A5CC0014EE4C /* MaskQuestionView.m */; };
83835BA0212E43BD001480F2 /* GiGaMasssagesVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83835B9F212E43BD001480F2 /* GiGaMasssagesVC.m */; };
83835BA7212E4748001480F2 /* MAssaageCenterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83835BA5212E4748001480F2 /* MAssaageCenterCell.m */; };
83835BA8212E4748001480F2 /* MAssaageCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83835BA6212E4748001480F2 /* MAssaageCenterCell.xib */; };
@@ -102,6 +106,8 @@
83A22718212ABDFF00B3E75C /* GiGaBlockButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A22717212ABDFF00B3E75C /* GiGaBlockButton.m */; };
83A2271F212AC8C100B3E75C /* GiGaUserLoginVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A2271D212AC8C100B3E75C /* GiGaUserLoginVC.m */; };
83A22720212AC8C100B3E75C /* GiGaUserLoginVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83A2271E212AC8C100B3E75C /* GiGaUserLoginVC.xib */; };
83BDC0582147B89900E74E0D /* GiGaAnswerViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BDC0562147B89900E74E0D /* GiGaAnswerViewCell.m */; };
83BDC0592147B89900E74E0D /* GiGaAnswerViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83BDC0572147B89900E74E0D /* GiGaAnswerViewCell.xib */; };
83BFAE67213CCF10004EF801 /* GiGaMineUserViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BFAE65213CCF10004EF801 /* GiGaMineUserViewCell.m */; };
83BFAE68213CCF10004EF801 /* GiGaMineUserViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83BFAE66213CCF10004EF801 /* GiGaMineUserViewCell.xib */; };
83BFAE6C213CD0E3004EF801 /* GiGaMineInfoViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BFAE6A213CD0E3004EF801 /* GiGaMineInfoViewCell.m */; };
@@ -242,6 +248,14 @@
836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaBaseAPiRequest.m; sourceTree = "<group>"; };
836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+Convenience.m"; sourceTree = "<group>"; };
836EE5D92136716000F0ABB2 /* NSTimer+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+Convenience.h"; sourceTree = "<group>"; };
83773FBA214769230014EE4C /* ExercisesModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExercisesModel.h; sourceTree = "<group>"; };
83773FBB214769230014EE4C /* ExercisesModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExercisesModel.m; sourceTree = "<group>"; };
83773FBD214791E10014EE4C /* GIGaQuestionSlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGaQuestionSlider.h; sourceTree = "<group>"; };
83773FBE214791E10014EE4C /* GIGaQuestionSlider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIGaQuestionSlider.m; sourceTree = "<group>"; };
83773FC021479FED0014EE4C /* UIColor+HexColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIColor+HexColor.h"; sourceTree = "<group>"; };
83773FC121479FED0014EE4C /* UIColor+HexColor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIColor+HexColor.m"; sourceTree = "<group>"; };
83773FC32147A5CC0014EE4C /* MaskQuestionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MaskQuestionView.h; sourceTree = "<group>"; };
83773FC42147A5CC0014EE4C /* MaskQuestionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MaskQuestionView.m; sourceTree = "<group>"; };
83835B9E212E43BD001480F2 /* GiGaMasssagesVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMasssagesVC.h; sourceTree = "<group>"; };
83835B9F212E43BD001480F2 /* GiGaMasssagesVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMasssagesVC.m; sourceTree = "<group>"; };
83835BA4212E4748001480F2 /* MAssaageCenterCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MAssaageCenterCell.h; sourceTree = "<group>"; };
@@ -303,6 +317,9 @@
83A2271C212AC8C100B3E75C /* GiGaUserLoginVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaUserLoginVC.h; sourceTree = "<group>"; };
83A2271D212AC8C100B3E75C /* GiGaUserLoginVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaUserLoginVC.m; sourceTree = "<group>"; };
83A2271E212AC8C100B3E75C /* GiGaUserLoginVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaUserLoginVC.xib; sourceTree = "<group>"; };
83BDC0552147B89900E74E0D /* GiGaAnswerViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAnswerViewCell.h; sourceTree = "<group>"; };
83BDC0562147B89900E74E0D /* GiGaAnswerViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAnswerViewCell.m; sourceTree = "<group>"; };
83BDC0572147B89900E74E0D /* GiGaAnswerViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaAnswerViewCell.xib; sourceTree = "<group>"; };
83BFAE64213CCF10004EF801 /* GiGaMineUserViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMineUserViewCell.h; sourceTree = "<group>"; };
83BFAE65213CCF10004EF801 /* GiGaMineUserViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMineUserViewCell.m; sourceTree = "<group>"; };
83BFAE66213CCF10004EF801 /* GiGaMineUserViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaMineUserViewCell.xib; sourceTree = "<group>"; };
@@ -644,6 +661,8 @@
8340BF9D213E3846008F22E4 /* SHineLabel.m */,
8345C13421414D3B00051717 /* NSString+Unicode.h */,
8345C13521414D3B00051717 /* NSString+Unicode.m */,
83773FC021479FED0014EE4C /* UIColor+HexColor.h */,
83773FC121479FED0014EE4C /* UIColor+HexColor.m */,
);
path = Category;
sourceTree = "<group>";
@@ -844,6 +863,8 @@
children = (
83835BCE212E8B9C001480F2 /* GiGaQuestionModel.h */,
83835BCF212E8B9C001480F2 /* GiGaQuestionModel.m */,
83773FBA214769230014EE4C /* ExercisesModel.h */,
83773FBB214769230014EE4C /* ExercisesModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -853,6 +874,13 @@
children = (
83835BC8212E8045001480F2 /* GIGAQuetionView.h */,
83835BC9212E8045001480F2 /* GIGAQuetionView.m */,
83773FBD214791E10014EE4C /* GIGaQuestionSlider.h */,
83773FBE214791E10014EE4C /* GIGaQuestionSlider.m */,
83773FC32147A5CC0014EE4C /* MaskQuestionView.h */,
83773FC42147A5CC0014EE4C /* MaskQuestionView.m */,
83BDC0552147B89900E74E0D /* GiGaAnswerViewCell.h */,
83BDC0562147B89900E74E0D /* GiGaAnswerViewCell.m */,
83BDC0572147B89900E74E0D /* GiGaAnswerViewCell.xib */,
);
path = View;
sourceTree = "<group>";
@@ -1118,6 +1146,7 @@
838388C4212F934400D14C53 /* pomodoSound.m4a in Resources */,
83BFAE78213CDE91004EF801 /* GiGaSettingsViewCell.xib in Resources */,
83346AC1212BB50A0054D597 /* PassWordResetVC.xib in Resources */,
83BDC0592147B89900E74E0D /* GiGaAnswerViewCell.xib in Resources */,
83346AD1212BF5B70054D597 /* useragreement.html in Resources */,
83BFAE68213CCF10004EF801 /* GiGaMineUserViewCell.xib in Resources */,
8340BFA9213E65CA008F22E4 /* GIGACommonLocalizabe.strings in Resources */,
@@ -1233,6 +1262,8 @@
838500DC2137F3F7003514A3 /* GiGaAttributedLabel.m in Sources */,
83BFAE7B213D3F3A004EF801 /* MaskTimeCircularProgressView.m in Sources */,
8314D2112133ABE500B458BF /* WeiIXinApiManager.m in Sources */,
83BDC0582147B89900E74E0D /* GiGaAnswerViewCell.m in Sources */,
83773FC52147A5CC0014EE4C /* MaskQuestionView.m in Sources */,
83835BCA212E8045001480F2 /* GIGAQuetionView.m in Sources */,
8361B3CE212155C200238FEB /* ViewController.m in Sources */,
8361B4382121847600238FEB /* UINavigationBar+Custom.m in Sources */,
@@ -1250,14 +1281,17 @@
83835BA0212E43BD001480F2 /* GiGaMasssagesVC.m in Sources */,
8357ADCD2123C091000816F2 /* GiGaNetManager.m in Sources */,
838388D4212FB7D700D14C53 /* JXTAlertView.m in Sources */,
83773FC221479FED0014EE4C /* UIColor+HexColor.m in Sources */,
835060A9212D38EE007E6220 /* GiGaStartAdView.m in Sources */,
83928FFA2134D8F60077D2E8 /* GiGaFlyingCommitInputView.m in Sources */,
838388D3212FB7D700D14C53 /* JXTAlertController.m in Sources */,
833DA7762122A62000A5C614 /* GiGaMaskTaskViewController.m in Sources */,
836EE5D7213645E300F0ABB2 /* GiGaBaseAPiRequest.m in Sources */,
83773FBC214769230014EE4C /* ExercisesModel.m in Sources */,
83835BD0212E8B9C001480F2 /* GiGaQuestionModel.m in Sources */,
83835BAF212E4FCD001480F2 /* MessageListViewCell.m in Sources */,
8361B3D9212155C300238FEB /* main.m in Sources */,
83773FBF214791E10014EE4C /* GIGaQuestionSlider.m in Sources */,
835060A2212D1225007E6220 /* GiGaMeViewController.m in Sources */,
8361B3CB212155C200238FEB /* AppDelegate.m in Sources */,
838388C8212F9C4200D14C53 /* GiGaLocalNotificationManager.m in Sources */,
@@ -2,4 +2,22 @@
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m"
timestampString = "558370995.03293"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "102"
endingLineNumber = "102"
landmarkName = "-initUI"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_slider_thumb@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_slider_thumb@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ceshi_number@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ceshi_number@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

+17
View File
@@ -0,0 +1,17 @@
//
// UIColor+HexColor.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HexColor)
+ (UIColor *)colorWithHex:(long)hexColor;
+ (UIColor *)colorWithHex:(long)hexColor alpha:(CGFloat)alpha;
@end
+27
View File
@@ -0,0 +1,27 @@
//
// UIColor+HexColor.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "UIColor+HexColor.h"
@implementation UIColor (HexColor)
+ (UIColor *)colorWithHex:(long)hexColor {
CGFloat red = ((CGFloat)((hexColor & 0xFF0000) >> 16))/255.0f;
CGFloat green = ((CGFloat)((hexColor & 0xFF00) >> 8))/255.0f;
CGFloat blue = ((CGFloat)(hexColor & 0xFF))/255.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];
}
+ (UIColor *)colorWithHex:(long)hexColor alpha:(CGFloat)alpha{
CGFloat red = ((CGFloat)((hexColor & 0xFF0000) >> 16))/255.0f;
CGFloat green = ((CGFloat)((hexColor & 0xFF00) >> 8))/255.0f;
CGFloat blue = ((CGFloat)(hexColor & 0xFF))/255.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
@end
+2 -2
View File
@@ -23,8 +23,8 @@
if (dic && ![dic isKindOfClass:[NSNull class]]) {
self.code = [[dic objectForKey:@"code"] integerValue];
self.message = [dic objectForKey:@"msg"];
NSDictionary *data = [[dic objectForKey:@"result"] objectForKey:@"data"];
self.dic = data;
// NSDictionary *data = [[dic objectForKey:@"result"] objectForKey:@"data"];
self.dic = dic;
}else{
self.message = @"请求异常";
@@ -111,11 +111,13 @@
[[LXDanMuManager shareInstance] start];
//socket
[self connetction];
//显示隐藏输入框
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (!isUserLogin) {
self.commitInputView.hidden = YES;
}
}
-(void)connetction{
@@ -205,7 +205,6 @@
self.swipeGaurdimagView.hidden = YES;
self.startMaskButton.hidden = YES;
self.startTestButton.hidden = YES;
[self.view layoutIfNeeded];
[UIView animateWithDuration:1.0 animations:^{
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
@@ -230,7 +229,6 @@
self.cicleProgressView.hidden = YES;
self.swipeGaurdimagView.hidden = NO;
self.startMaskButton.hidden = NO;
self.startTestButton.hidden = NO;
[self.view layoutIfNeeded];
[UIView animateWithDuration:1.0 animations:^{
@@ -368,7 +366,6 @@
MPMediaItemPropertyArtwork:arwork
};
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:dic];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
}
@@ -409,21 +406,20 @@
#pragma mark 开始测试
-(void)testBtnAcion:(UIButton *)btn{
// [self createInputView];
// return;
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
// BOOL isUserLogin = [GiGaUserDefault isUserLogin];
//
// if (isUserLogin) {
GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init];
[self.navigationController pushViewController:questionVC animated:YES];
}else{
GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
[self presentViewController:baseNav animated:YES completion:nil];
}
// }else{
// GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
// GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
// [self presentViewController:baseNav animated:YES completion:nil];
// }
}
-(void)addNotify{
@@ -532,7 +528,7 @@
[self.view addSubview:self.waringView];
[UIView animateWithDuration:0.4 animations:^{
self.waringView.frame = CGRectMake(0,CGRectGetMaxY(self.view.frame) - 60 - PhoneX_BottomMargin, self.view.frame.size.width, 60);
self.waringView.frame = CGRectMake(0,CGRectGetMaxY(self.view.frame) - 44 - PhoneX_BottomMargin, self.view.frame.size.width, 44);
}];
[self.waringView showView];
}
@@ -7,18 +7,24 @@
//
#import "GiGaQuestionVC.h"
#import "GIGAQuetionView.h"
#import "GiGaQuestionModel.h"
#import "Masonry.h"
#import "GiGaBaseAPiRequest.h"
#import "GiGaNetManager.h"
#import "GIGaQuestionSlider.h"
#import "MaskQuestionView.h"
#import "ExercisesModel.h"
@interface GiGaQuestionVC ()
@property (nonatomic,weak) GIGAQuetionView *questionView;
@property (nonatomic,weak) MaskQuestionView *questionView;
@property (nonatomic,assign) NSInteger page;
@property (nonatomic,strong) NSMutableArray *questonArray;
@property (nonatomic,strong) GiGaQuestionModel *currentModel;
@property (nonatomic,strong) ExercisesModel *currentModel;
@property (nonatomic,strong) UILabel *questionlabel;
@property (nonatomic,strong) UIButton *nextBtn;
@property (nonatomic,strong) UIButton *preBtn;
@end
@implementation GiGaQuestionVC
@@ -28,10 +34,80 @@
[super viewDidLoad];
// self.title = @"测试肤质";
_page = 1;
//模拟服务器数据
[self initControls];
[self setquestionArray];
[self getQuestionsInfo];
//
[self loadRequestQuestions];
//[self initUI];
}
-(void)initUI{
UIButton *numberBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[numberBtn setBackgroundImage:[UIImage imageNamed:@"ceshi_number"] forState:UIControlStateNormal];
NSAttributedString *numbertitle = [[NSAttributedString alloc] initWithString:@"1" attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[numberBtn setAttributedTitle:numbertitle forState:UIControlStateNormal];
[self.view addSubview:numberBtn];
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = @"悄悄地告诉你小优的年龄区间是?";
titleLabel.font = [UIFont fontWithName:GIGA_FONTBOLD size:16];
titleLabel.textColor = GIGARGB(63, 63, 63, 1);
[self.view addSubview:titleLabel];
UILabel *descLabel = [[UILabel alloc] init];
descLabel.text = @"精准的选择,让小优更好的为您挑选最符合您的肤质的面膜";
descLabel.font = [UIFont fontWithName:GIGA_FONTNAME size:12];
descLabel.textColor = GIGARGB(208, 208, 208, 1);
descLabel.numberOfLines = 0;
descLabel.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:descLabel];
[numberBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(31, 31));
make.top.mas_equalTo(self.view.mas_top).offset(112 + PhoneX_TopMargin);
make.left.mas_equalTo(self.view.mas_left).offset(46);
}];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(numberBtn.mas_right).offset(12);
make.centerY.mas_equalTo(numberBtn.mas_centerY);
make.right.mas_equalTo(self.view.mas_right).offset(-53);
}];
[descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(numberBtn.mas_right).offset(12);
make.top.mas_equalTo(titleLabel.mas_bottom).offset(20);
make.right.mas_equalTo(self.view.mas_right).offset(-89);
}];
//选择题view
NSArray *titles = @[@"hahah",@"呵呵呵呵",@"哦哦",@"有有u哟哦",@"呵呵呵呵"];
NSMutableArray *tit = [NSMutableArray new];
ExercisesModel *model = self.questonArray[0];
NSArray *modeA = model.answerList;
for (NSDictionary *mode in modeA){
[tit addObject:mode[@"answer"]];
}
titles = tit;
MaskQuestionView *questionView = [[MaskQuestionView alloc] initQuestionView:CGRectMake(0,248, self.view.frame.size.width,212) style:MaskQuetionViewStleSliderNormal titles:titles];
questionView.backgroundColor = [UIColor redColor];
[self.view addSubview:questionView];
self.questionView = questionView;
}
-(void)updateValue:(UISlider *)slider{
NSLog(@"value%f",slider.value);
GILog(@"formatvalue:%.2f",slider.value*60);
}
@@ -42,19 +118,24 @@
return _questonArray;
}
-(void)setquestionArray{
NSArray *array = @[
@{@"questionid" : @"1", @"totalCount" : @"5", @"question" : @"如果昨天是明天的话就好了,这样今天就周五了。真实的今天可能是星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"星期三:理想今天是星期五,昨天是星期四,真实明天是理想的昨天是星期四,真实的今天是星期三。\n星期日:理想今天是星期五,明天是星期六,真实昨天是理想的明天是星期六,真实的今天是星期日。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A:星期三星期三星期三星期三星期三星期三星期三", @"B:星期四", @"C:星期五星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三星期三"]},
@{@"questionid" : @"2", @"totalCount" : @"5", @"question" : @"这里是问题,这道题的答案是AC。这里是问题,这道题的答案是AC。这里是问题,这道题的答案是AC。", @"questiontype" : @"1", @"questiontype_text" : @"多选题", @"questionselectnumber" : @"5", @"questiondescribe" : @"这里是答案解析,这里可以很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长的。", @"trueanswer" : @"AC", @"userAnswer" : @[], @"tkselect" : @[@"A:这个选项是正确的。这个选项是正确的。这个选项是正确的。", @"B:这个选项是错误的。这个选项是错误的。这个选项是错误的。", @"C:这个选项是正确的。这个选项是正确的。这个选项是正确的。", @"D:这个选项是错误的。这个选项是错误的。这个选项是错误的。", @"E:这个选项是错误的。这个选项是错误的。这个选项是错误的。"]},
@{@"questionid" : @"3", @"totalCount" : @"5", @"question" : @"以下哪个牌子不是化妆品?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"化妆品,化妆品化妆品化妆品化妆品化妆品化妆品化妆品。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A:化妆品", @"B:化妆品", @"C:星期五"]},
@{@"questionid" : @"4", @"totalCount" : @"5", @"question" : @"如果昨天是明天的话就好了,这样今天就周五了。真实的今天可能是星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"真实昨天是理想的明天是星期六,真实的今天是星期日?", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A:星三", @"B:星", @"C:期"]},
@{@"questionid" : @"5", @"totalCount" : @"5", @"question" : @"星期几?", @"questiontype" : @"1", @"questiontype_text" : @"单选题", @"questionselectnumber" : @"3", @"questiondescribe" : @"星期三:理想今天是星期五,昨天是星期四,真实明天是理想的昨天是星期四,真实的今天是星期三。\n星期日:理想今天是星期五,明天是星期六,真实昨天是理想的明天是星期六,真实的今天是星期日。", @"trueanswer" : @"A", @"userAnswer" : @[], @"tkselect" : @[@"A:三", @"B:四", @"C:五"]},
-(void)loadRequestQuestions{
];
for (NSDictionary *dic in array) {
GiGaQuestionModel *model = [[GiGaQuestionModel alloc] initWithDictionary:dic error:nil];
NSDictionary *params = @{};
GiGaBaseAPiRequest *request = [GiGaBaseAPiRequest initWithRequestPath:@"activity/maskquestion/v1/list" method:RequestPostMethod parms:params];
[request requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
NSLog(@"result:%@",result.dic);
NSArray *list = result.dic[@"list"];
NSDictionary *answer = list[0];
for (NSDictionary *answerDic in list) {
ExercisesModel *model = [[ExercisesModel alloc] initWithDictionary:answerDic error:nil];
[self.questonArray addObject:model];
}
[self initUI];
}
}];
}
@@ -62,109 +143,37 @@
-(void)getQuestionsInfo{
_currentModel = _questonArray[_page - 1];
[self reloadViews];
}
#pragma mark 刷新题目
-(void)reloadViews{
//刷新问题相关数据
NSString *questionlabelText = [NSString stringWithFormat:@"%@.%@", _currentModel.questionid, _currentModel.question];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:4.0f];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:questionlabelText];
NSDictionary *attrs =@{NSFontAttributeName:[UIFont systemFontOfSize:18]};
[attributedString setAttributes:attrs range:NSMakeRange(0, 2)];
_questionlabel.attributedText = attributedString;
// NSString *questionlabelText = [NSString stringWithFormat:@"%@.%@", _currentModel.questionid, _currentModel.question];
// NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
// [paragraphStyle setLineSpacing:4.0f];
// NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:questionlabelText];
// NSDictionary *attrs =@{NSFontAttributeName:[UIFont systemFontOfSize:18]};
// [attributedString setAttributes:attrs range:NSMakeRange(0, 2)];
//
// _questionlabel.attributedText = attributedString;
[self.view layoutIfNeeded];//必加
//刷新答案相关数据
[_questionView reloadViewWithFrame:CGRectMake(30, CGRectGetMaxY(_questionlabel.frame) + 15, KMainW - 30*2, 0) style:[_currentModel.questiontype intValue] - 1 answerArray:_currentModel.tkselect userAnswers:_currentModel.userAnswer];
// //刷新答案相关数据
// [_questionView reloadViewWithFrame:CGRectMake(30, CGRectGetMaxY(_questionlabel.frame) + 15, KMainW - 30*2, 0) style:[_currentModel.questiontype intValue] - 1 answerArray:_currentModel.tkselect userAnswers:_currentModel.userAnswer];
}
#pragma mark 创建控件
-(void)initControls{
//顶部
UIImageView *topBackImagiew = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
topBackImagiew.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:topBackImagiew];
[topBackImagiew mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KMainW - 30*2);
make.height.mas_equalTo(140);
make.top.mas_equalTo(self.view.mas_top).offset(100);
make.left.mas_equalTo(self.view.mas_left).offset(30);
}];
UILabel *desLabel = [[UILabel alloc] init];
desLabel.text = @"通过测试可以得知您是什么肤质,有助于选择更适合的面膜";
desLabel.font = [UIFont systemFontOfSize:22];
desLabel.numberOfLines = 0;
[desLabel sizeToFit];
[topBackImagiew addSubview:desLabel];
[desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(topBackImagiew.center);
make.width.mas_equalTo(KMainW - 30*2 - 20*2);
}];
//问题标签
UILabel *questionLabel = [[UILabel alloc] init];
questionLabel.textColor = GIGAUIColorFromRGBA(0x292929);
questionLabel.font = [UIFont systemFontOfSize:15.f];
questionLabel.numberOfLines = 0;
[self.view addSubview:questionLabel];
self.questionlabel = questionLabel;
[self.questionlabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left).offset(30);
make.top.mas_equalTo(topBackImagiew.mas_bottom).offset(10);
make.right.mas_equalTo(self.view.mas_right).offset(-30);
}];
//选择题view
GIGAQuetionView *questionView = [[GIGAQuetionView alloc] init];
questionView.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:questionView];
self.questionView = questionView;
// [self.questionView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(self.questionlabel.mas_bottom).offset(10);
// make.height.mas_equalTo(0);
// make.left.mas_equalTo(self.view.mas_left).offset(30);
// make.right.mas_equalTo(self.view.mas_right).offset(-30);
// }];
//下一题
UIButton *nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
nextBtn.backgroundColor = [UIColor purpleColor];
[nextBtn setTitle:@"下一个" forState:UIControlStateNormal];
[nextBtn addTarget:self action:@selector(nextBtnAction) forControlEvents:UIControlEventTouchUpInside];
nextBtn.layer.masksToBounds = YES;
nextBtn.layer.cornerRadius = 2;
[self.view addSubview:nextBtn];
self.nextBtn = nextBtn;
[nextBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.view.mas_bottom).offset(-100);
make.width.mas_equalTo(160);
make.height.mas_equalTo(40);
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
}
-(void)nextBtnAction{
if (_page == [_currentModel.totalCount integerValue] ) {
GIGA_ShowToast(@"没有了");
return;
}
[self saveProgress];
_page ++ ;
//获取题目信息
[self getQuestionsInfo];
// if (_page == [_currentModel.totalCount integerValue] ) {
// GIGA_ShowToast(@"没有了");
// return;
// }
// [self saveProgress];
// _page ++ ;
// //获取题目信息
// [self getQuestionsInfo];
//self.nextBtn.enabled = _page == [_currentModel.totalCount integerValue] ? NO : YES;
@@ -172,10 +181,10 @@
#pragma mark -做题记录
-(void)saveProgress{
NSString *answer = self.questionView.selectAnswer;
NSString *anserNum = self.questionView.qrnum;
NSString *anserid = _currentModel.questionid;
GILog(@"选择答案:%@\n 角标:%@\n 题号:%@",answer,anserNum,anserid);
// NSString *answer = self.questionView.selectAnswer;
// NSString *anserNum = self.questionView.qrnum;
// NSString *anserid = _currentModel.questionid;
// GILog(@"选择答案:%@\n 角标:%@\n 题号:%@",answer,anserNum,anserid);
}
- (void)didReceiveMemoryWarning {
@@ -0,0 +1,38 @@
//
// ExercisesModel.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <JSONModel/JSONModel.h>
//内层模型
//@protocol QustionAnswer//内层模型协议
//@end
@class QustionAnswer;
@interface QustionAnswer:JSONModel
@property (nonatomic,copy) NSString *answer;
@property (nonatomic,assign) int bsjz;
@property (nonatomic,copy) NSString *createTime;
@property (nonatomic,assign) int dryness;
@property (nonatomic,assign) int fx;
@end
//外层模型
@interface ExercisesModel : JSONModel
@property (nonatomic,strong) NSMutableArray<QustionAnswer *>* answerList;
@property (nonatomic,assign) int questionType;
@property (nonatomic,assign) int sortNum;
@property (nonatomic,copy) NSString *remark;
@property (nonatomic,copy) NSString *question;
@end
@@ -0,0 +1,16 @@
//
// ExercisesModel.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "ExercisesModel.h"
@implementation ExercisesModel
//+(JSONKeyMapper *)keyMapper{
// return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{@"id":@"answer_id"}];
//}
@end
@@ -0,0 +1,21 @@
//
// GIGaQuestionSlider.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,GIGaQuestionSliderType)
{
GIGaQuestionSliderTypeGray = 0,//灰
GIGaQuestionSliderTypeGradient ,//变色
};
@interface GIGaQuestionSlider : UISlider
- (instancetype)initWithFrame:(CGRect)frame type:(GIGaQuestionSliderType)type;
@end
@@ -0,0 +1,115 @@
//
// GIGaQuestionSlider.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GIGaQuestionSlider.h"
#import "UIColor+HexColor.h"
@interface GIGaQuestionSlider()
@end
@implementation GIGaQuestionSlider
- (instancetype)initWithFrame:(CGRect)frame type:(GIGaQuestionSliderType)type
{
self = [super initWithFrame:frame];
if (self) {
self.minimumValue = 0.0;
self.maximumValue = 1.0;
self.value = 0.5;
[self creatSubView:type];
}
return self;
}
-(void)creatSubView:(GIGaQuestionSliderType)type{
[self thumbimageView];
switch (type) {
case GIGaQuestionSliderTypeGray:
{
[self createUI];
}
break;
case GIGaQuestionSliderTypeGradient:
{
[self creatGradient];
}
break;
default:
break;
}
}
-(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:0x9A9996] CGColor]];
NSArray *colorLocationArray = @[@0.0, @0.5, @1];
CAGradientLayer * gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = self.bounds;
gradientLayer.masksToBounds = YES;
gradientLayer.cornerRadius = self.frame.size.height /2 ;
gradientLayer.borderWidth = 1;
gradientLayer.borderColor =GIGARGB(215, 215, 215, 1).CGColor;
[gradientLayer setLocations:colorLocationArray];
[gradientLayer setColors:colorArr];
[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.value = 0.5;
self.minimumTrackTintColor = GIGARGB(216,216, 216, 1);
self.maximumTrackTintColor = GIGARGB(216,216, 216, 1);
}
-(CGRect)trackRectForBounds:(CGRect)bounds
{
bounds.origin.x = bounds.origin.x;
bounds.origin.y = bounds.origin.y;
bounds.size.height = bounds.size.height;
bounds.size.width = bounds.size.width;
return bounds;
}
-(void)thumbimageView{
[self setThumbImage:[self OriginImage:[UIImage imageNamed:@"btn_slider_thumb"] scaleToSize:CGSizeMake(40, 40)] forState:UIControlStateNormal];
[self setThumbImage:[self OriginImage:[UIImage imageNamed:@"btn_slider_thumb"] scaleToSize:CGSizeMake(40, 40)] forState:UIControlStateHighlighted];
}
-(UIImage*) OriginImage:(UIImage*)image scaleToSize:(CGSize)size
{
UIGraphicsBeginImageContext(size);//size为CGSize类型,即你所需要的图片尺寸
[image drawInRect:CGRectMake(0,0, size.width, size.height)];
UIImage* scaledImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
@end
@@ -0,0 +1,14 @@
//
// GiGaAnswerViewCell.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaAnswerViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *answerTitle;
@end
@@ -0,0 +1,24 @@
//
// GiGaAnswerViewCell.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaAnswerViewCell.h"
@implementation GiGaAnswerViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,54 @@
<?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">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="GiGaAnswerViewCell" id="KGk-i7-Jjw" customClass="GiGaAnswerViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lXL-TA-ugK">
<rect key="frame" x="0.0" y="10" width="96" height="1"/>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="1" id="34F-F0-EkR"/>
<constraint firstAttribute="width" constant="96" id="AX3-TO-AIq"/>
<constraint firstAttribute="height" constant="1" id="CAS-mG-3dd"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iR5-Lj-9dP">
<rect key="frame" x="106" y="0.0" width="198" height="20"/>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="14"/>
<color key="textColor" red="0.76470588235294112" green="0.15686274509803921" blue="0.15686274509803921" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="iR5-Lj-9dP" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="304-cd-159"/>
<constraint firstAttribute="trailing" secondItem="iR5-Lj-9dP" secondAttribute="trailing" constant="16" id="MYZ-d5-ASU"/>
<constraint firstItem="lXL-TA-ugK" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="dzx-Mu-xz2"/>
<constraint firstItem="lXL-TA-ugK" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="o2d-gS-JsL"/>
<constraint firstItem="lXL-TA-ugK" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="uJK-WQ-wVS"/>
<constraint firstItem="iR5-Lj-9dP" firstAttribute="leading" secondItem="lXL-TA-ugK" secondAttribute="trailing" constant="10" id="x2y-To-TgM"/>
<constraint firstItem="lXL-TA-ugK" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="yDs-SX-6eP"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="answerTitle" destination="iR5-Lj-9dP" id="Jlc-ce-rWZ"/>
</connections>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,24 @@
//
// MaskQuestionView.h
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,MaskQuetionViewStyle)
{
MaskQuetionViewStleSliderNormal = 0,// 滑块正常
MaskQuetionViewStleSliderGradient ,//滑块变色
MaskQuetionViewStleYesOrNO // 是 否
};
@interface MaskQuestionView : UIView
@property(nonatomic,assign) MaskQuetionViewStyle *style;
-(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles;
@end
@@ -0,0 +1,121 @@
//
// MaskQuestionView.m
// GIGA
//
// Created by lianxiang on 2018/9/11.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "MaskQuestionView.h"
#import "GIGaQuestionSlider.h"
#import "GiGaAnswerViewCell.h"
@interface MaskQuestionView()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong) NSArray *dataArr;
@property(nonatomic,strong) UITableView *tableView;
@property(nonatomic,strong) GIGaQuestionSlider *slider;
@end
@implementation MaskQuestionView
-(NSArray *)dataArr
{
if (!_dataArr) {
_dataArr = [NSArray new];
}
return _dataArr;
}
-(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles{
self = [super initWithFrame:frame];
if (self) {
self.dataArr = titles;
[self creatSubs:style titles:titles];
}
return self;
}
-(void)creatSubs:(MaskQuetionViewStyle)style titles:(NSArray *)titles{
switch (style) {
case MaskQuetionViewStleSliderNormal:
{
[self creatNormalStyle:titles];
}
break;
case MaskQuetionViewStleSliderGradient:
{
}
break;
case MaskQuetionViewStleYesOrNO:
{
}
break;
default:
break;
}
}
-(void)creatNormalStyle:(NSArray *)titles{
[self creatTab];
GIGaQuestionSlider *slider = [[GIGaQuestionSlider alloc] initWithFrame:CGRectMake(0,self.frame.size.height,self.frame.size.height, 13) type:GIGaQuestionSliderTypeGray];
[slider addTarget:self action:@selector(updateValue:) forControlEvents:UIControlEventValueChanged];
self.slider = slider;
[self addSubview:slider];
self.slider.transform = CGAffineTransformMakeRotation(- M_PI/2);
}
-(void)layoutSubviews{
[super layoutSubviews];
self.slider.frame = CGRectMake(90, 0, self.slider.frame.size.width, self.frame.size.height);
}
-(void)updateValue:(UISlider *)slider{
NSLog(@"value%f",slider.value);
GILog(@"formatvalue:%.2f",slider.value*60);
}
-(void)creatTab{
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(127,0, self.frame.size.width - 127, self.frame.size.height) style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
self.tableView.scrollEnabled = NO;
[self addSubview:self.tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return (self.frame.size.height - 20) / (self.dataArr.count -1);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
GiGaAnswerViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaAnswerViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaAnswerViewCell" owner:self options:nil] lastObject];
}
cell.answerTitle.text =self.dataArr[indexPath.row];
return cell;
}
@end
@@ -52,6 +52,12 @@
_isMoving = NO;
self.countLabel.frame = CGRectMake(_lineWidth, self.frame.size.height /2 - 15 , self.frame.size.width - _lineWidth*2, 30);
[self addSubview:self.countLabel];
UILabel *minlabel = [[UILabel alloc] init];
minlabel.frame = CGRectMake(CGRectGetMidX(self.countLabel.frame) - (18/2) , CGRectGetMaxY(self.countLabel.frame) + 8, 18, 14);
minlabel.text = @"min";
minlabel.textColor = [UIColor whiteColor];
minlabel.font = [UIFont fontWithName:GIGA_FONTNAME size:10];
[self addSubview:minlabel];
}
@@ -204,8 +210,7 @@
self.countLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",minute,second];
if (hour == 0 && minute == 0 && second == 0) {
//面膜结束
//[self maskTimeEnd];
[self.timer destoryTimer];
[self.playTimer invalidate];
self.playTimer = nil;
@@ -46,7 +46,7 @@
[self addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.mas_right).offset(10);
make.right.mas_equalTo(self.mas_right).offset(-10);
make.centerY.mas_equalTo(self.mas_centerY);
make.width.and.height.mas_equalTo(40);
@@ -59,7 +59,7 @@
[UIView animateWithDuration:0.4 animations:^{
self.frame = CGRectMake(0, KMainH, KMainW, 60);
self.frame = CGRectMake(0, KMainH, KMainW, 44);
} completion:^(BOOL finished) {
[self removeFromSuperview];