diff --git a/GIGA.xcodeproj/project.pbxproj b/GIGA.xcodeproj/project.pbxproj index a2c8d1a..16d6871 100644 --- a/GIGA.xcodeproj/project.pbxproj +++ b/GIGA.xcodeproj/project.pbxproj @@ -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 = ""; }; 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+Convenience.m"; sourceTree = ""; }; 836EE5D92136716000F0ABB2 /* NSTimer+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+Convenience.h"; sourceTree = ""; }; + 83773FBA214769230014EE4C /* ExercisesModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExercisesModel.h; sourceTree = ""; }; + 83773FBB214769230014EE4C /* ExercisesModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExercisesModel.m; sourceTree = ""; }; + 83773FBD214791E10014EE4C /* GIGaQuestionSlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGaQuestionSlider.h; sourceTree = ""; }; + 83773FBE214791E10014EE4C /* GIGaQuestionSlider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIGaQuestionSlider.m; sourceTree = ""; }; + 83773FC021479FED0014EE4C /* UIColor+HexColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIColor+HexColor.h"; sourceTree = ""; }; + 83773FC121479FED0014EE4C /* UIColor+HexColor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIColor+HexColor.m"; sourceTree = ""; }; + 83773FC32147A5CC0014EE4C /* MaskQuestionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MaskQuestionView.h; sourceTree = ""; }; + 83773FC42147A5CC0014EE4C /* MaskQuestionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MaskQuestionView.m; sourceTree = ""; }; 83835B9E212E43BD001480F2 /* GiGaMasssagesVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMasssagesVC.h; sourceTree = ""; }; 83835B9F212E43BD001480F2 /* GiGaMasssagesVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMasssagesVC.m; sourceTree = ""; }; 83835BA4212E4748001480F2 /* MAssaageCenterCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MAssaageCenterCell.h; sourceTree = ""; }; @@ -303,6 +317,9 @@ 83A2271C212AC8C100B3E75C /* GiGaUserLoginVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaUserLoginVC.h; sourceTree = ""; }; 83A2271D212AC8C100B3E75C /* GiGaUserLoginVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaUserLoginVC.m; sourceTree = ""; }; 83A2271E212AC8C100B3E75C /* GiGaUserLoginVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaUserLoginVC.xib; sourceTree = ""; }; + 83BDC0552147B89900E74E0D /* GiGaAnswerViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAnswerViewCell.h; sourceTree = ""; }; + 83BDC0562147B89900E74E0D /* GiGaAnswerViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAnswerViewCell.m; sourceTree = ""; }; + 83BDC0572147B89900E74E0D /* GiGaAnswerViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaAnswerViewCell.xib; sourceTree = ""; }; 83BFAE64213CCF10004EF801 /* GiGaMineUserViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMineUserViewCell.h; sourceTree = ""; }; 83BFAE65213CCF10004EF801 /* GiGaMineUserViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMineUserViewCell.m; sourceTree = ""; }; 83BFAE66213CCF10004EF801 /* GiGaMineUserViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GiGaMineUserViewCell.xib; sourceTree = ""; }; @@ -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 = ""; @@ -844,6 +863,8 @@ children = ( 83835BCE212E8B9C001480F2 /* GiGaQuestionModel.h */, 83835BCF212E8B9C001480F2 /* GiGaQuestionModel.m */, + 83773FBA214769230014EE4C /* ExercisesModel.h */, + 83773FBB214769230014EE4C /* ExercisesModel.m */, ); path = Model; sourceTree = ""; @@ -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 = ""; @@ -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 */, diff --git a/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ed9a9b4..7cb5a4d 100644 --- a/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/GIGA.xcworkspace/xcuserdata/lianxiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,4 +2,22 @@ + + + + + + diff --git a/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/Contents.json new file mode 100644 index 0000000..dfb5d15 --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@2x.png b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@2x.png new file mode 100644 index 0000000..e006dca Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@3x.png b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@3x.png new file mode 100644 index 0000000..7330578 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/btn_slider_thumb.imageset/btn_slider_thumb@3x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json new file mode 100644 index 0000000..f80543f --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@2x.png b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@2x.png new file mode 100644 index 0000000..2494e50 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@3x.png b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@3x.png new file mode 100644 index 0000000..7e0917e Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/ceshi_number@3x.png differ diff --git a/GIGA/Category/UIColor+HexColor.h b/GIGA/Category/UIColor+HexColor.h new file mode 100644 index 0000000..04f22eb --- /dev/null +++ b/GIGA/Category/UIColor+HexColor.h @@ -0,0 +1,17 @@ +// +// UIColor+HexColor.h +// GIGA +// +// Created by lianxiang on 2018/9/11. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import + +@interface UIColor (HexColor) + ++ (UIColor *)colorWithHex:(long)hexColor; + ++ (UIColor *)colorWithHex:(long)hexColor alpha:(CGFloat)alpha; + +@end diff --git a/GIGA/Category/UIColor+HexColor.m b/GIGA/Category/UIColor+HexColor.m new file mode 100644 index 0000000..128f386 --- /dev/null +++ b/GIGA/Category/UIColor+HexColor.m @@ -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 diff --git a/GIGA/Common/GiGaNetTool/GiGaAPIResult.m b/GIGA/Common/GiGaNetTool/GiGaAPIResult.m index 20f5739..af1a487 100644 --- a/GIGA/Common/GiGaNetTool/GiGaAPIResult.m +++ b/GIGA/Common/GiGaNetTool/GiGaAPIResult.m @@ -23,9 +23,9 @@ 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 = @"请求异常"; self.dic = nil; diff --git a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m index 619672e..ac2a8ac 100644 --- a/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m +++ b/GIGA/Modules/Mask/Controller/GiGaFlingCommitVC.m @@ -111,11 +111,13 @@ [[LXDanMuManager shareInstance] start]; //socket [self connetction]; + //显示隐藏输入框 BOOL isUserLogin = [GiGaUserDefault isUserLogin]; if (!isUserLogin) { self.commitInputView.hidden = YES; } + } -(void)connetction{ diff --git a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m index c21f520..ad18546 100644 --- a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m +++ b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m @@ -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]; +// BOOL isUserLogin = [GiGaUserDefault isUserLogin]; +// +// if (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]; } diff --git a/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m b/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m index c9d9d01..d8c1df6 100644 --- a/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m +++ b/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m @@ -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,11 +34,81 @@ [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); + } -(NSMutableArray *)questonArray{ @@ -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:五"]}, - - ]; - for (NSDictionary *dic in array) { - GiGaQuestionModel *model = [[GiGaQuestionModel alloc] initWithDictionary:dic error:nil]; - [self.questonArray addObject:model]; - } +-(void)loadRequestQuestions{ + + 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 { diff --git a/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h new file mode 100644 index 0000000..ecc1d47 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h @@ -0,0 +1,38 @@ +// +// ExercisesModel.h +// GIGA +// +// Created by lianxiang on 2018/9/11. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import + +//内层模型 +//@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* answerList; +@property (nonatomic,assign) int questionType; +@property (nonatomic,assign) int sortNum; +@property (nonatomic,copy) NSString *remark; +@property (nonatomic,copy) NSString *question; + +@end + + diff --git a/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.m b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.m new file mode 100644 index 0000000..70cd9f6 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.m @@ -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 diff --git a/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.h b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.h new file mode 100644 index 0000000..103a515 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.h @@ -0,0 +1,21 @@ +// +// GIGaQuestionSlider.h +// GIGA +// +// Created by lianxiang on 2018/9/11. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import +typedef NS_ENUM(NSInteger,GIGaQuestionSliderType) +{ + GIGaQuestionSliderTypeGray = 0,//灰 + GIGaQuestionSliderTypeGradient ,//变色 + + +}; + +@interface GIGaQuestionSlider : UISlider +- (instancetype)initWithFrame:(CGRect)frame type:(GIGaQuestionSliderType)type; + +@end diff --git a/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m new file mode 100644 index 0000000..5f461ac --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m @@ -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 diff --git a/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.h b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.h new file mode 100644 index 0000000..74eea07 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.h @@ -0,0 +1,14 @@ +// +// GiGaAnswerViewCell.h +// GIGA +// +// Created by lianxiang on 2018/9/11. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import + +@interface GiGaAnswerViewCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UILabel *answerTitle; + +@end diff --git a/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.m b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.m new file mode 100644 index 0000000..4dd4b24 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.m @@ -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 diff --git a/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.xib b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.xib new file mode 100644 index 0000000..3c8b4af --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/GiGaAnswerViewCell.xib @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h new file mode 100644 index 0000000..41d6834 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h @@ -0,0 +1,24 @@ +// +// MaskQuestionView.h +// GIGA +// +// Created by lianxiang on 2018/9/11. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import + +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 diff --git a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m new file mode 100644 index 0000000..1019f85 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m @@ -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() +@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 diff --git a/GIGA/Modules/Mask/View/MaskTimeCircularProgressView.m b/GIGA/Modules/Mask/View/MaskTimeCircularProgressView.m index 720e60f..4ca794c 100644 --- a/GIGA/Modules/Mask/View/MaskTimeCircularProgressView.m +++ b/GIGA/Modules/Mask/View/MaskTimeCircularProgressView.m @@ -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; diff --git a/GIGA/Modules/Mask/View/MaskViewBootomWaringView.m b/GIGA/Modules/Mask/View/MaskViewBootomWaringView.m index 4274f19..976ec95 100644 --- a/GIGA/Modules/Mask/View/MaskViewBootomWaringView.m +++ b/GIGA/Modules/Mask/View/MaskViewBootomWaringView.m @@ -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];