This commit is contained in:
lianxiang
2018-09-26 00:33:06 +08:00
parent 69522b22fc
commit d0230f55ed
68 changed files with 1599 additions and 209 deletions
@@ -61,12 +61,15 @@
-(void)mycuntomSwitchAction:(id)sender{
LXCustomSwith *nkswitch = (LXCustomSwith *)sender;
if (nkswitch.isOn)
NSLog(@"switchPressed ON");
else
[[LXDanMuManager shareInstance] destory];
[self destorySocket];
NC_POST_NAME_OBJECT(@"UserCloseChatRoomAction", nil);
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"switchPressed OFF");
}
@@ -74,6 +77,7 @@
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
NC_ADD_TARGET_NAME_OBJECT(self, @selector(maskTimeEnd), kUserNoti_MASKEND, nil);
[IQKeyboardManager sharedManager].enable = NO;
[[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];
}
@@ -51,12 +51,32 @@
@property(nonatomic,strong) UIImageView *swipeGaurdimagView;
@property(nonatomic,strong) UIButton *startMaskButton;
@property(nonatomic,strong) UIButton *startTestButton;
//开启弹幕按钮
@property(nonatomic,strong) UIButton *openDanmuButton;
@end
@implementation GiGaMaskTaskViewController
#pragma mark - property
- (UIButton *)openDanmuButton{
if (!_openDanmuButton) {
_openDanmuButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_openDanmuButton addTarget:self action:@selector(openDanmuButtonAction) forControlEvents:UIControlEventTouchUpInside];
_openDanmuButton.backgroundColor = GIGARGB(112, 0, 0, 1);
_openDanmuButton.frame = CGRectMake(KMainW - 25 -50,SAFE_NAV_HEIGHT + 15, 50, 20);
_openDanmuButton.layer.masksToBounds = YES;
_openDanmuButton.layer.cornerRadius = 10;
NSAttributedString *att = [GiGaHelper stringWithText:@"弹幕" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTMEDIUM(10) leterSpace:0];
[_openDanmuButton setAttributedTitle:att forState:UIControlStateNormal];
[_openDanmuButton setImage:[UIImage imageNamed:@"btn_talk"] forState:UIControlStateNormal];
//_openDanmuButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
_openDanmuButton.titleEdgeInsets = UIEdgeInsetsMake(0, -25, 0, 25);
}
return _openDanmuButton;
}
//面膜
- (UIImageView *)maskImageView{
if (!_maskImageView) {
@@ -174,7 +194,7 @@
[super viewWillAppear:animated];
//取消导航对内容下移影响
[self.navigationController.navigationBar setTranslucent:YES];
self.openDanmuButton.hidden = NO;
}
@@ -184,11 +204,19 @@
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
if (showAppGaurd == NO) {
[self showAPPappGaurdView];
// 暂不用 app引导页
// BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
// if (showAppGaurd == NO) {
// [self showAPPappGaurdView];
// }
//新手蒙版
BOOL isshowGaurd = [GiGaUserDefault isShowedGaurd];
if (isshowGaurd == NO) {
NSLog(@"%d",(int)isshowGaurd );
[self showUserGaurdView];
}
//[self showUserGaurdView];
}
-(void)viewWillDisappear:(BOOL)animated{
@@ -318,7 +346,7 @@
-(void)initUI{
self.view.backgroundColor = GIGA_MAIN_BGCOLOR;
[self.view addSubview:self.openDanmuButton];
[self.view addSubview:self.faceView];
[self.view addSubview:self.maskImageView];
[self.view addSubview:self.hairImageView];
@@ -479,6 +507,7 @@
-(void)maskTimeEnd{
NC_POST_NAME_OBJECT(kUserNoti_MASKEND, nil);
//面膜时间结束时设置 全局变量 不再发送本地通知 提醒
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
delegate.isMasking = NO;
@@ -502,8 +531,7 @@
// resultVC.model = model;
// [self.navigationController pushViewController:resultVC animated:YES];
//[self showAlertGoShareMaskTime];
// [self showAlertGoShareMaskTime];
GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init];
[self.navigationController pushViewController:questionVC animated:YES];
@@ -511,13 +539,19 @@
}
-(void)addNotify{
//引导页
NC_ADD_TARGET_NAME_OBJECT(self, @selector(guardViewDissmiss), USER_GUARD_DISSMISS, nil) ;
NC_ADD_TARGET_NAME_OBJECT(self, @selector(appGauardViewDissmiss),APP_GUARD_DISSMISS, nil) ;
NC_ADD_TARGET_NAME_OBJECT(self, @selector(pushToAppAdDetailView),APP_PUSHTO_DETAILVIEW, nil) ;
NC_ADD_TARGET_NAME_OBJECT(self, @selector(userLoginNotify), kUserLoginSuccessNoti, nil);
NC_ADD_TARGET_NAME_OBJECT(self, @selector(userlogOutNotify), kUserLogOutNotify, nil);
NC_ADD_TARGET_NAME_OBJECT(self, @selector(userAvatorUpDate), kUserAvatorUpdateNoti, nil) ;
//用户关闭弹幕聊天
NC_ADD_TARGET_NAME_OBJECT(self, @selector(userCloseChatRoomAction), @"UserCloseChatRoomAction", nil);
}
#pragma mark 广告详情
@@ -527,9 +561,11 @@
[self.navigationController pushViewController:detailVC animated:YES];
}
#pragma mark 新手引导消失
#pragma mark 新手引导蒙版消失
-(void)guardViewDissmiss{
[self showWaringView];
}
#pragma mark app引导页消失
@@ -549,6 +585,8 @@
NC_REMOVE_NAME(self, kUserAvatorUpdateNoti, nil);
NC_REMOVE_NAME(self, kUserLogOutNotify, nil);
NC_REMOVE_NAME(self, kUserLoginSuccessNoti, nil);
NC_REMOVE_NAME(self, @"UserCloseChatRoomAction", nil);
}
#pragma mark 新手引导
@@ -623,16 +661,20 @@
-(void)leftBtnAction{
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
GiGaMasssagesVC *masageVC= [[GiGaMasssagesVC alloc] init];
[self.navigationController pushViewController:masageVC animated:YES];
}else{
GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
[self presentViewController:baseNav animated:YES completion:nil];
}
}
#pragma mark 个人中心 action
@@ -718,5 +760,14 @@
}];
}
#pragma mark - 开启弹幕按钮事件
-(void)openDanmuButtonAction{
self.openDanmuButton.hidden = YES;
[self createInputView];
}
//通知用户挂断弹幕
-(void)userCloseChatRoomAction{
self.openDanmuButton.hidden = NO;
}
@end
@@ -13,6 +13,12 @@
#import "MaskTimeShareActionSheet.h"
#import "GIGaUserFileHelper.h"
#import <AVFoundation/AVFoundation.h>
#import "GiGaFileNanager.h"
//#import "WXApiObject.h"
#import <WXApiObject.h>
#import <WXApi.h>
#import "UIImage+ShotImage.h"
@interface ShareViewController ()<UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property(nonatomic,strong) UITableView *tab;
@property(nonatomic,strong) UIImageView *backimageview ;
@@ -27,35 +33,41 @@
[super viewDidLoad];
_curentImageIndex = 0;
UIImageView *backimageview = [[UIImageView alloc] init];
backimageview.contentMode = UIViewContentModeScaleAspectFill;
backimageview.frame = CGRectMake(0, 0,self.view.frame.size.width, self.view.frame.size.height);
backimageview.userInteractionEnabled = YES;
backimageview.image = [GIGaUserFileHelper getUserShareImage:kUSERSHAREA_IMAGENAME];
// self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sharebg_1"]];
self.backimageview = backimageview;
[self.view addSubview:backimageview];
[self creatTabUI];
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
backBtn.frame = CGRectMake(20,44, 40, 40);
[backBtn setImage:[UIImage imageNamed:@"btn_moment_back"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:backBtn];
[self.view insertSubview:backimageview atIndex:0];
[self creatBtns];
}
-(void)creatTabUI{
self.automaticallyAdjustsScrollViewInsets = NO;
self.tab = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
self.tab.separatorStyle = UITableViewCellSelectionStyleNone;
self.tab.delegate = self;
self.tab.dataSource = self;
self.tab.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.tab];
UIImageView *backimageview = [[UIImageView alloc] init];
backimageview.contentMode = UIViewContentModeScaleAspectFill;
backimageview.frame = CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height);
backimageview.userInteractionEnabled = YES;
backimageview.image = [GIGaUserFileHelper getUserShareImage:kUSERSHAREA_IMAGENAME];
// self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sharebg_1"]];
self.backimageview = backimageview;
self.tab.backgroundView = backimageview;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
@@ -146,10 +158,9 @@
}
//更换背景
-(void)changeAction{
MaskTimeShareActionSheet * sheet = [[MaskTimeShareActionSheet alloc] initWithFrame:CGRectMake(0, 0, KMainW, KMainH)];
[sheet show:^(NSUInteger index) {
switch (index) {
@@ -186,6 +197,7 @@
[self.view addSubview:sheet];
}
#pragma mark 相册
-(void)photosAlbum{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.allowsEditing = YES;
@@ -217,6 +229,7 @@
}
//拍照
-(void)takePhoto{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.allowsEditing = YES;
@@ -263,9 +276,9 @@
UIImage*img=[info objectForKey:UIImagePickerControllerEditedImage];
UIImage *small = [GIGaUserFileHelper zipScaleWithImage:img];
[GIGaUserFileHelper savaShareImange:kUSERSHAREA_IMAGENAME image:small];
[self.backimageview setImage:small];
ShareViewController *share = [[ShareViewController alloc] init];
[self presentViewController:share animated:NO completion:nil];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
@@ -273,7 +286,48 @@
}
-(void)shareBtnAction{
if (![WXApi isWXAppInstalled]) {
GIGA_ShowToast(@"未安装微信");
return;
}
UIImage *image = [UIImage saveLongImage:self.tab];
[self jxt_showActionSheetWithTitle:@"分享微信" message:@"" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionDefaultTitle(@"朋友");
alertMaker.addActionDefaultTitle(@"朋友圈");
alertMaker.addActionCancelTitle(@"取消");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex==0) {
//好友
[self shareImagToWX:image scene:WXSceneSession];
}else if (buttonIndex==1){
// 朋友圈
[self shareImagToWX:image scene:WXSceneTimeline];
}
}];
}
-(void)shareImagToWX:(UIImage *)image scene:(int)scene{
WXMediaMessage *msg = [WXMediaMessage message];
UIImage * masllThumb = [GIGaUserFileHelper scaleFromImage:image toSize:CGSizeMake(100, 100)];
msg.title = @"面膜时间";
msg.description= @"极迦面膜";
[msg setThumbImage:masllThumb];
WXImageObject *imageObject = [WXImageObject object];
NSData *imageData = UIImagePNGRepresentation(image);
imageObject.imageData = imageData;
msg.mediaObject = imageObject;
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
req.message = msg;
req.scene = scene;
req.bText = NO;
[WXApi sendReq:req];
}
@end
@@ -248,7 +248,7 @@
-(void)loadRequestQuestions{
NSDictionary *params = @{};
GiGaBaseAPiRequest *request = [GiGaBaseAPiRequest initWithRequestPath:@"activity/maskquestion/v1/list" method:RequestPostMethod parms:params];
GiGaBaseAPiRequest *request = [GiGaBaseAPiRequest initWithRequestPath:kApiSkinTestQuestionList method:RequestPostMethod parms:params];
[self.view makeToastActivity:CSToastPositionCenter];
[request requstDataWithResult:^(GiGaAPIResult *result) {
@@ -359,42 +359,15 @@
-(void)submitAnswer{
NSDictionary *params = @{@"singleChoiceList":self.answerArray};
[self.view makeToastActivity:CSToastPositionCenter];
NSString *url = [NSString stringWithFormat:@"%@activity/maskquestion/v1/result",[GiGaServerConfig getMainUrl]];
[GiGaNetManager userbodyRequest:url params:params completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) {
[self.view hideToastActivity];
GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:resDic];
if (result.success) {
MaskTestResult* mode = [[MaskTestResult alloc] initWithDictionary:resDic error:nil];
[self userTestEnd:mode];
}else{
GIGA_ShowToast(result.message);
}
GILog(@"**测试结果***\n code:%ld\n message:%@\n *******\n dic:%@",result.code,result.message,result.dic);
}];
[self userTestEnd];
}
-(void)userTestEnd:(MaskTestResult*)model{
-(void)userTestEnd{
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
//展示结果
// NSDictionary *dic = @{
// @"dryness":@"0.41",
// @"drynessPercent":@"41%",
// @"mask":@"",
// @"minute":@"19",
// @"oiliness":@"0.59",
// @"oilinessPercent":@"59%"
// };
// MaskTestResult *model =[[MaskTestResult alloc] initWithDictionary:dic error:nil];
MaskTestResultVC *resultVC = [[MaskTestResultVC alloc] init];
resultVC.model = model;
[self.navigationController pushViewController:resultVC animated:YES];
[self getTestResult];
}else{
[self jxt_showAlertWithTitle:@"对不起您还没有登录" message:@"请登录后查看肤质测试结果" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
@@ -416,6 +389,46 @@
}
//获取结果
-(void)getTestResult{
NSDictionary *params = @{@"singleChoiceList":self.answerArray};
[self.view makeToastActivity:CSToastPositionCenter];
NSString *url = [NSString stringWithFormat:@"%@%@",[GiGaServerConfig getMainUrl],kAiSkinTestResult];
[GiGaNetManager userbodyRequest:url params:params completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) {
[self.view hideToastActivity];
GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:resDic];
if (result.success) {
MaskTestResult* mode = [[MaskTestResult alloc] initWithDictionary:resDic error:nil];
NSUInteger minute = [mode.minute integerValue];
NSTimeInterval time = minute * 60;
[GiGaUserDefault savaMaskeTime:time];
//展示结果
// NSDictionary *dic = @{
// @"dryness":@"0.41",
// @"drynessPercent":@"41%",
// @"mask":@"",
// @"minute":@"19",
// @"oiliness":@"0.59",
// @"oilinessPercent":@"59%"
// };
// MaskTestResult *model =[[MaskTestResult alloc] initWithDictionary:dic error:nil];
MaskTestResultVC *resultVC = [[MaskTestResultVC alloc] init];
resultVC.model = mode;
[self.navigationController pushViewController:resultVC animated:YES];
}else{
GIGA_ShowToast(result.message);
}
GILog(@"**测试结果***\n code:%ld\n message:%@\n *******\n dic:%@",result.code,result.message,result.dic);
}];
}
-(void)preBtnAction{
_page -- ;
@@ -12,4 +12,5 @@
@interface MaskTestResultVC : GiGaBaseViewController
@property (nonatomic,strong) MaskTestResult *model;
@end
@@ -10,9 +10,12 @@
#import "MaskResultMinViewCell.h"
#import "MaskResultPercentCell.h"
#import "MaskResultShareViewCell.h"
#import "GIGaUserFileHelper.h"
#import "UIImage+ShotImage.h"
#import "GiGaBaseAPiRequest.h"
#import "GiGaFileNanager.h"
#import <WXApi.h>
#import "MaskTestResult.h"
@interface MaskTestResultVC ()
@@ -22,9 +25,9 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self addNavTitile:@"测试结果"];
// Do any additional setup after loading the view.
[self.view addSubview:self.tableView];
self.tableView.delegate = self;
self.tableView.dataSource = self;
@@ -39,6 +42,32 @@
[self.tableView registerClass:[MaskResultMinViewCell class] forCellReuseIdentifier:@"MaskResultMinViewCell"];
[self.tableView registerClass:[MaskResultShareViewCell class] forCellReuseIdentifier:@"MaskResultShareViewCell"];
if (!self.model) {
[self addNavTitile:@"历史测试"];
[self requstLatestTestData];
}
}
-(void)requstLatestTestData{
[self.view makeToastActivity:CSToastPositionCenter];
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:kApiGetLatestTest method:RequestPostMethod parms:@{}];
[api requstDataWithResult:^(GiGaAPIResult *result) {
[self.view hideToastActivity];
if (result.success) {
NSDictionary *dic = result.dic;
NSDictionary *reult = dic[@"result"];
MaskTestResult *resultMode = [[MaskTestResult alloc] initWithDictionary:reult error:nil];
self.model = resultMode;
[self.tableView reloadData];
}else{
GIGA_ShowToast(result.message);
}
}];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
@@ -76,7 +105,7 @@
cell = [[MaskResultShareViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];;
}
[cell.shareBtn addTarget:self action:@selector(shareBtnAciton) forControlEvents:UIControlEventTouchUpInside];
[cell kidTitle:self.model.mask];
[cell kidTitle:self.model];
return cell;
}
@@ -101,41 +130,53 @@
}
-(void)shareBtnAciton{
UIImage *image = [self saveLongImage:self.tableView];
// SHareTestImageVC *imagevc = [[SHareTestImageVC alloc] init];
// imagevc.image = image;
//[self.navigationController pushViewController:imagevc animated:YES];
if (![WXApi isWXAppInstalled]) {
GIGA_ShowToast(@"未安装微信");
return;
}
UIImage *image = [UIImage saveLongImage:self.tableView];
//[[GiGaFileNanager shareInstance] saveImaeToAlBum:image];
[self jxt_showActionSheetWithTitle:@"分享微信" message:@"" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionDefaultTitle(@"朋友");
alertMaker.addActionDefaultTitle(@"朋友圈");
alertMaker.addActionCancelTitle(@"取消");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex==0) {
//好友
[self shareImagToWX:image scene:WXSceneSession];
}else if (buttonIndex==1){
// 朋友圈
[self shareImagToWX:image scene:WXSceneTimeline];
}
}];
}
-(void)shareImagToWX:(UIImage *)image scene:(int)scene{
WXMediaMessage *msg = [WXMediaMessage message];
UIImage * masllThumb = [GIGaUserFileHelper scaleFromImage:image toSize:CGSizeMake(100, 100)];
msg.title = @"面膜时间";
msg.description= @"极迦面膜";
[msg setThumbImage:masllThumb];
WXImageObject *imageObject = [WXImageObject object];
NSData *imageData = UIImagePNGRepresentation(image);
imageObject.imageData = imageData;
msg.mediaObject = imageObject;
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
req.message = msg;
req.scene = scene;
req.bText = NO;
[WXApi sendReq:req];
}
- (UIImage *)saveLongImage:(UITableView *)table {
UIImage* image = nil;
// 下面方法,第一个参数表示区域大小。第二个参数表示是否是非透明的。如果需要显示半透明效果,需要传NO,否则传YES。第三个参数就是屏幕密度了,调整清晰度。
UIGraphicsBeginImageContextWithOptions(table.contentSize, YES, [UIScreen mainScreen].scale);
CGPoint savedContentOffset = table.contentOffset;
CGRect savedFrame = table.frame;
table.contentOffset = CGPointZero;
table.frame = CGRectMake(0, 0, table.contentSize.width, table.contentSize.height);
[table.layer renderInContext: UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
table.contentOffset = savedContentOffset;
table.frame = savedFrame;
UIGraphicsEndImageContext();
[[GiGaFileNanager shareInstance] saveImaeToAlBum:image];
return image;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
@@ -16,6 +16,11 @@
@property(nonatomic,copy) NSString *minute;
@property(nonatomic,copy) NSString *oiliness;
@property(nonatomic,copy) NSString *oilinessPercent;
//保湿0无1有
@property(nonatomic) int moisture;
//美白0无1有
@property(nonatomic) int whitening;
//提拉紧致0无1有
@property(nonatomic) int liftingTightening;
@end
@@ -8,14 +8,19 @@
#import "GIGaQuestionSlider.h"
#import "UIColor+HexColor.h"
#define thumbBound_x 10
#define thumbBound_y 20
@interface GIGaQuestionSlider()
{
CGRect _lastBounds;
}
@end
@implementation GIGaQuestionSlider
- (instancetype)initWithFrame:(CGRect)frame type:(GIGaQuestionSliderType)type
{
self = [super initWithFrame:frame];
@@ -112,5 +117,53 @@
}
// 扩大thumb 触控区域
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value
{
rect.origin.x = rect.origin.x;
rect.size.width = rect.size.width ;
CGRect result = [super thumbRectForBounds:bounds trackRect:rect value:value];
_lastBounds = result;
return result;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *result = [super hitTest:point withEvent:event];
if (point.x < 0 || point.x > self.bounds.size.width){
return result;
}
if ((point.y >= -thumbBound_y) && (point.y < _lastBounds.size.height + thumbBound_y)) {
float value = 0.0;
value = point.x - self.bounds.origin.x;
value = value/self.bounds.size.width;
value = value < 0? 0 : value;
value = value > 1? 1: value;
value = value * (self.maximumValue - self.minimumValue) + self.minimumValue;
[self setValue:value animated:YES];
}
return result;
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
BOOL result = [super pointInside:point withEvent:event];
if (!result && point.y > -10) {
if ((point.x >= _lastBounds.origin.x - thumbBound_x) && (point.x <= (_lastBounds.origin.x + _lastBounds.size.width + thumbBound_x)) && (point.y < (_lastBounds.size.height + thumbBound_y))) {
result = YES;
}
}
return result;
}
@end
@@ -9,6 +9,11 @@
#import <UIKit/UIKit.h>
@interface MaskResultCandView : UIView
@property(nonatomic,strong) UIImageView *shuiImageView;
@property(nonatomic,strong) UIImageView *meibaiImageView;
@property(nonatomic,strong) UIImageView *tilaImageView;
@property(nonatomic,strong) NSArray *imagesArr;
- (instancetype)initWith:(NSArray *)images;
-(void)updateImages:(NSArray *)images;
@end
@@ -24,7 +24,17 @@
-(void)creatSubs{
for (NSInteger i=0; i<self.imagesArr.count; i ++) {
UIImageView *image = [[UIImageView alloc] init];
if (i==0) {
self.shuiImageView = image;
}else if (i==1){
self.meibaiImageView = image;
}else if (i==2){
self.tilaImageView= image;
}
image.contentMode = UIViewContentModeScaleAspectFill;
image.image = [UIImage imageNamed:self.imagesArr[i]];
image.layer.shadowColor = [UIColor blackColor].CGColor;
@@ -50,4 +60,19 @@
//[self creatSubs];
}
-(void)updateImages:(NSArray *)images
{
for (NSInteger i=0; i<images.count; i++) {
if (i==0) {
self.shuiImageView.image = [UIImage imageNamed:images[i]];
}else if (i==1){
self.meibaiImageView.image = [UIImage imageNamed:images[i]];
}else{
self.tilaImageView.image = [UIImage imageNamed:images[i]];
}
}
}
@end
@@ -91,9 +91,11 @@
}];
[self bringSubviewToFront:jianyiLabel];
[self bringSubviewToFront:timeLabel];
}
- (void)layoutSubviews{
[super layoutSubviews];
[self drawViewInView:self.colorView backColor:GIGA_MAIN_BGCOLOR];
@@ -122,11 +124,15 @@
}
-(void)loadMineWith:(NSString *)minute{
if ([minute isKindOfClass:[NSNull class]]) {
minute = @"17";
}
NSString *time = [NSString stringWithFormat:@"%@分钟",minute];
self.timeLabel.text = time;
}
-(void)laoutSettings{
}
@@ -7,10 +7,13 @@
//
#import <UIKit/UIKit.h>
#import "MaskTestResult.h"
#import "MaskResultCandView.h"
@interface MaskResultShareViewCell : UITableViewCell
@property (nonatomic,strong) UIButton *shareBtn;
-(void)kidTitle:(NSString *)title;
@property (nonatomic,strong) MaskResultCandView *imagsBackView;
-(void)kidTitle:(MaskTestResult *)model;
@property (nonatomic,strong) UILabel *candLabe;
@@ -48,7 +48,9 @@
}];
//小图标
NSArray * imagesArr = @[@"result_water",@"result_moon",@"result_push"];
MaskResultCandView *imagsBackView = [[MaskResultCandView alloc] initWith:imagesArr];
self.imagsBackView = imagsBackView;
[self addSubview:imagsBackView];
[imagsBackView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -114,11 +116,19 @@
}
-(void)kidTitle:(NSString *)title{
if (!title || [title isEqualToString:@""] || [title isKindOfClass:[NSNull class]]) {
title = @"全效型";
-(void)kidTitle:(MaskTestResult *)model{
if (!model.mask || [model.mask isEqualToString:@""] || [model.mask isKindOfClass:[NSNull class]]) {
model.mask = @"全效型";
}
self.candLabe.text = title;
self.candLabe.text = model.mask;
NSString *water = model.moisture ==1 ? @"result_water":@"result_wmz";
NSString *meibai = model.whitening ==1 ? @"result_moon":@"result_ylwmz";
NSString *tila= model.liftingTightening ==1 ? @"result_push":@"result_wmzzz";
[self.imagsBackView updateImages:@[water,meibai,tila]];
}
-(void)layoutSubviews{
@@ -8,6 +8,14 @@
#import "NYSliderPopover.h"
#import "NYPopover.h"
#define thumbBound_x 10
#define thumbBound_y 20
@interface NYSliderPopover()
{
CGRect _lastBounds;
}
@end
@implementation NYSliderPopover
@@ -183,4 +191,55 @@
}
// 扩大thumb 触控区域
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value
{
rect.origin.x = rect.origin.x;
rect.size.width = rect.size.width ;
CGRect result = [super thumbRectForBounds:bounds trackRect:rect value:value];
_lastBounds = result;
return result;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *result = [super hitTest:point withEvent:event];
if (point.x < 0 || point.x > self.bounds.size.width){
return result;
}
if ((point.y >= -thumbBound_y) && (point.y < _lastBounds.size.height + thumbBound_y)) {
float value = 0.0;
value = point.x - self.bounds.origin.x;
value = value/self.bounds.size.width;
value = value < 0? 0 : value;
value = value > 1? 1: value;
value = value * (self.maximumValue - self.minimumValue) + self.minimumValue;
[self setValue:value animated:YES];
}
return result;
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
BOOL result = [super pointInside:point withEvent:event];
if (!result && point.y > -10) {
if ((point.x >= _lastBounds.origin.x - thumbBound_x) && (point.x <= (_lastBounds.origin.x + _lastBounds.size.width + thumbBound_x)) && (point.y < (_lastBounds.size.height + thumbBound_y))) {
result = YES;
}
}
return result;
}
@end
@@ -103,7 +103,7 @@ static const CGFloat kInputViewH = 44.f;
}
if (self.inputTextField.text.length == 0) {
[[UIApplication sharedApplication].keyWindow makeToast:@"Comment content cannot be empty" duration:1 position:CSToastPositionCenter];
[[UIApplication sharedApplication].keyWindow makeToast:@"弹幕不能为空" duration:1 position:CSToastPositionCenter];
return;
}
@@ -7,8 +7,8 @@
//
#import "MaskShareBoootomViewCell.h"
#import "ZXingWrapper.h"
//#import "ZXingWrapper.h"
#import "UIImage+LogoQrCode.h"
@implementation MaskShareBoootomViewCell
@@ -16,7 +16,9 @@
[super awakeFromNib];
// Initialization code
self.backgroundColor = [UIColor clearColor];
UIImage *imag = [ZXingWrapper createCodeWithString:@"app_logo" size:CGSizeMake(85, 85) CodeFomart:kBarcodeFormatQRCode];
// UIImage *imag = [ZXingWrapper createCodeWithString:@"giga" size:CGSizeMake(170, 170) CodeFomart:kBarcodeFormatQRCode];
UIImage *imag = [UIImage createQrImageWith:[UIImage imageNamed:@"result_logo"] logoSize:CGSizeZero qrText:@"jijia"];
self.codeImageVIew.image = imag;
}