This commit is contained in:
lianxiang
2018-09-27 00:20:01 +08:00
parent d0230f55ed
commit cb0accdb66
60 changed files with 1063 additions and 290 deletions
@@ -9,5 +9,6 @@
#import "GiGaBaseViewController.h"
@interface GIGaMaskShareViewController : GiGaBaseViewController
@property(nonatomic,copy) NSString *maskTimeId;
@end
@@ -14,8 +14,11 @@
#import "MaskTimeShareActionSheet.h"
#import "GIGaUserFileHelper.h"
#import <AVFoundation/AVFoundation.h>
#import "GiGaBaseAPiRequest.h"
#import "GiGaShareModel.h"
#import "UIImageView+WebCache.h"
@interface GIGaMaskShareViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property(nonatomic,strong) GiGaShareModel *model;
@end
@implementation GIGaMaskShareViewController
@@ -33,7 +36,9 @@
self.tableView.estimatedSectionHeaderHeight = 0;
//self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, 30)];
self.tableView.frame = CGRectMake(0,0,KMainW, self.view.frame.size.height);
// Do any additional setup after loading the view.
[self requestshareInfo];
}
- (void)didReceiveMemoryWarning {
@@ -56,13 +61,29 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskTimeEndViewImgaeCell" owner:self options:nil] lastObject];
}
if (self.model) {
cell.minuteLab.text = [NSString stringWithFormat:@"%@min",self.model.minute];
cell.timeLable.text = [NSString stringWithFormat:@"这是您敷面膜的第:%@张",self.model.monthMaskNum];
}
return cell;
}else if (indexPath.section == 1){
MaskTimeTimeViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskTimeTimeViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskTimeTimeViewCell" owner:self options:nil] lastObject];
}
if (self.model) {
cell.timeLabe.text = self.model.minute;
CGFloat percent = [self.model.exquisite floatValue];
int perrr = percent * 100;
NSString *per = [NSString stringWithFormat:@"%d",perrr];
cell.percentLabe.text = per;
cell.totalTime.text = self.model.totalMaskNum;
NSURL *url = [NSURL URLWithString:self.model.headImgUrl];
[cell.useravator sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"nav_circle_avatar"]];
}
return cell;
}else if (indexPath.section == 2){
@@ -86,7 +107,7 @@
return 205;
}
return 90;
return 120;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
@@ -101,7 +122,7 @@
#pragma mark changeBackBtnAction
-(void)changeBackBtnAction{
MaskTimeShareActionSheet * sheet = [[MaskTimeShareActionSheet alloc] initWithFrame:CGRectMake(0, 0, KMainW, KMainH)];
MaskTimeShareActionSheet * sheet = [MaskTimeShareActionSheet showAtView:self];
[sheet show:^(NSUInteger index) {
switch (index) {
case 0:
@@ -114,6 +135,7 @@
//系统
[GIGaUserFileHelper delectShareImage:kUSERSHAREA_IMAGENAME];
ShareViewController *share = [[ShareViewController alloc] init];
share.model = self.model;
[self presentViewController:share animated:NO completion:nil];
}
@@ -129,15 +151,15 @@
}
}];
[self.view addSubview:sheet];
}
#pragma mark share
-(void)shareBtnAction{
ShareViewController *share = [[ShareViewController alloc] init];
[self presentViewController:share animated:NO completion:nil];
share.model = self.model;
[self presentViewController:share animated:YES completion:nil];
}
@@ -220,6 +242,7 @@
[GIGaUserFileHelper savaShareImange:kUSERSHAREA_IMAGENAME image:small];
ShareViewController *share = [[ShareViewController alloc] init];
share.model = self.model;
[self presentViewController:share animated:NO completion:nil];
}
@@ -227,5 +250,23 @@
[picker dismissViewControllerAnimated:YES completion:nil];
}
-(void)requestshareInfo{
if (self.maskTimeId == nil) {
return;
}
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:kApiShareAction method:RequestPostMethod parms:@{@"id":self.maskTimeId}];
[api requstDataWithResult:^(GiGaAPIResult *result){
if (result.success) {
NSDictionary *dic = result.dic;
GiGaShareModel *model = [[GiGaShareModel alloc] initWithDictionary:dic error:nil];
self.model = model;
[self.tableView reloadData];
}
}];
}
@end
@@ -46,8 +46,11 @@
}
return _danmuSwitch;
}
- (GiGaFlyingCommitInputView *)commitInputView{
if (!_commitInputView) {
@@ -139,10 +142,10 @@
_manager = manager;
_client = manager.defaultSocket;
[self.manager connect];
weakify(self);
[self.client on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
GIGA_WIndowTost(@"客户端上线");
//GIGA_WIndowTost(@"客户端上线");
NSLog(@"*************\n\niOS客户端上线\n\n*************");
}];
@@ -154,9 +157,11 @@
[self.client on:@"onTalk" callback:^(NSArray * _Nonnull data, SocketAckEmitter * _Nonnull ack) {
NSString *json =data[0];
NSLog(@"callback json***:%@",json);
NSDictionary *dic = [GiGaHelper dictionaryWithJsonString:json];
//NSString *json =data[0];
//NSDictionary *dic = [GiGaHelper dictionaryWithJsonString:json];
NSDictionary *dic = data[0];
NSLog(@"callback json***:%@",dic);
if (dic == nil) {
NSLog(@"解析失败");
@@ -176,15 +181,8 @@
[self.client on:@"error" callback:^(NSArray * _Nonnull event, SocketAckEmitter * _Nonnull ack) {
[GIGAMBHUDHelper messageAddto:self.view title:@"连接弹幕"];
// NSString *htmlString =event[0];
// htmlString = [self htmlEntityDecode:htmlString];
//
// UIWebView * webView = [[UIWebView alloc]initWithFrame:CGRectMake(20, 300, self.view.frame.size.width - 40, 400)];
// [webView loadHTMLString:htmlString baseURL:nil];
// [self.view addSubview:webView];
//
// NSLog(@"*************\n\n%@\n\n*************",event?event[0]:@"");
[GIGAMBHUDHelper messageAddto:self.view title:@"连接弹幕中..."];
GILog(@"请求超时");
}];
@@ -33,9 +33,11 @@
#import "GiGaBaseAPiRequest.h"
#import "MaskTestResultVC.h"
#import "GIGaMaskShareViewController.h"
#import "MaskHistryRecord.h"
#import "MaskTimeTopAnimationView.h"
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate>
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate,MaskTimeTextViewDelegate>
{
AVAudioPlayer *_musicPalyer;
}
@@ -53,13 +55,28 @@
@property(nonatomic,strong) UIButton *startTestButton;
//开启弹幕按钮
@property(nonatomic,strong) UIButton *openDanmuButton;
//记录当前面试时间 记录开id
@property(nonatomic,copy) NSString *currentMaskId;
@property(nonatomic,strong) MaskTimeTopAnimationView *animLabeview;
@end
@implementation GiGaMaskTaskViewController
#pragma mark - property
- (MaskTimeTopAnimationView *)animLabeview{
if (!_animLabeview) {
_animLabeview = [[MaskTimeTopAnimationView alloc] initWithFrame:CGRectMake(0,20+ PhoneX_TopMargin,KMainW - 40 * 2, 44)];
NSString *text = @"长时间的使用面膜可能会对您的皮肤造成伤害";
[_animLabeview animationWithTexts:[NSArray arrayWithObjects:text,@"面膜时间",text, nil]];
//_animLabeview.backgroundColor = [UIColor blueColor];
}
return _animLabeview;
}
- (UIButton *)openDanmuButton{
if (!_openDanmuButton) {
_openDanmuButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -177,7 +194,7 @@
#pragma mark 弹幕
-(void)createInputView{
self.openDanmuButton.hidden = YES;
GiGaFlingCommitVC* GiGaFlingVC = [[GiGaFlingCommitVC alloc] init];
if (ISIOS8) {
GiGaFlingVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
@@ -228,13 +245,13 @@
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setUpNav];
[self initUI];
[self addNotify];
[self creatBackGroundMusic];
}
#pragma mark - 响应事件
@@ -345,18 +362,18 @@
#pragma mark 布局
-(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];
//[self.view bringSubviewToFront:self.maskImageView];
[self.view addSubview:self.swipeGaurdimagView];
[self.view addSubview:self.startMaskButton];
[self.view addSubview:self.startTestButton];
[self.view addSubview:self.cicleProgressView];
//face
[self.faceView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(124 + PhoneX_TopMargin);
@@ -442,7 +459,8 @@
#pragma mark 开始面膜时间
-(void)startMaskTime{
//记录
[self sendBengainMaskTime];
[self createInputView]; //出现弹幕
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
if (delegate.isMasking) {
@@ -450,17 +468,18 @@
}
delegate.isMasking = YES;
[_musicPalyer play];
[self setBackGroundPlayingInfo];//锁屏音频信息
//[self setBackGroundPlayingInfo];//锁屏音频信息
//总时间隔 s
NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
//NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
NSTimeInterval timeInterVal = 6;
[self.cicleProgressView startWith:timeInterVal];
//底部弹窗
[self showWaringView];
//app 前台时收到本地通知showAlert 后台时通知提醒
[[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"本地推送" fireTimeInterval:timeInterVal alertAction:@"测试面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
// [[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"本地推送" fireTimeInterval:timeInterVal alertAction:@"测试面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
}
@@ -506,8 +525,8 @@
#pragma mark 面膜时间结束
-(void)maskTimeEnd{
[self sendEndMaskTime];
NC_POST_NAME_OBJECT(kUserNoti_MASKEND, nil);
//面膜时间结束时设置 全局变量 不再发送本地通知 提醒
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
delegate.isMasking = NO;
@@ -579,6 +598,7 @@
}
-(void)dealloc{
NC_REMOVE_NAME(self, USER_GUARD_DISSMISS, nil);
NC_REMOVE_NAME(self, APP_GUARD_DISSMISS, nil);
NC_REMOVE_NAME(self, APP_PUSHTO_DETAILVIEW, nil);
@@ -586,7 +606,6 @@
NC_REMOVE_NAME(self, kUserLogOutNotify, nil);
NC_REMOVE_NAME(self, kUserLoginSuccessNoti, nil);
NC_REMOVE_NAME(self, @"UserCloseChatRoomAction", nil);
}
#pragma mark 新手引导
@@ -612,12 +631,12 @@
#pragma mark - 导航按钮
-(void)setUpNav{
//leftItem
// UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
// leftBtn.frame = CGRectMake(0, 0, 40, 40);
// leftBtn.backgroundColor = [UIColor redColor];
// [leftBtn setImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
// [leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
// self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 40, 40);
//leftBtn.backgroundColor = [UIColor redColor];
//[leftBtn setImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
//[leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
//rightItem
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -647,6 +666,8 @@
}
}
}
self.navigationController.navigationBar.backgroundColor = [UIColor whiteColor];
}
#pragma mark 用户头像更新
@@ -746,23 +767,30 @@
-(void)showAlertGoShareMaskTime{
[self jxt_showAlertWithTitle:@"面膜时间" message:@"去分享我的面膜时间" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"下次");
alertMaker.addActionDefaultTitle(@"去分享");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (self.currentMaskId == nil) {
return;
}
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
//游客不分享
[self jxt_showAlertWithTitle:@"面膜时间" message:@"去分享我的面膜时间" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"下次");
alertMaker.addActionDefaultTitle(@"去分享");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex == 1) {
GIGaMaskShareViewController *shareVC = [[GIGaMaskShareViewController alloc] init];
shareVC.maskTimeId = self.currentMaskId;
[self.navigationController pushViewController:shareVC animated:YES];
}
}];
if (buttonIndex == 1) {
GIGaMaskShareViewController *shareVC = [[GIGaMaskShareViewController alloc] init];
[self.navigationController pushViewController:shareVC animated:YES];;
}
}];
}
}
#pragma mark - 开启弹幕按钮事件
-(void)openDanmuButtonAction{
self.openDanmuButton.hidden = YES;
[self createInputView];
}
//通知用户挂断弹幕
@@ -770,4 +798,43 @@
self.openDanmuButton.hidden = NO;
}
#pragma mark 开始敷面膜 APi
-(void)sendBengainMaskTime{
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
NSString *minute = [NSString stringWithFormat:@"%.f",timeInterVal /60];
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:KApiBeginMaskTime method:RequestPostMethod parms:@{@"minute":minute}];
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
NSDictionary *maskDic = result.dic[@"maskUseLog"];
self.currentMaskId = maskDic[@"id"];
}
}];
}
}
#pragma mark 结束敷面膜 APi
-(void)sendEndMaskTime{
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
if (isUserLogin) {
if (self.currentMaskId) {
GiGaBaseAPiRequest *api = [GiGaBaseAPiRequest initWithRequestPath:kApiEndMaskTime method:RequestPostMethod parms:@{@"id":self.currentMaskId}];
[api requstDataWithResult:^(GiGaAPIResult *result) {
if (result.success) {
GILog(@"%@",@"面膜时间APi结束");
}
}];
}
}
}
-(void)addNavTitile:(NSString *)title{
self.navigationItem.titleView = self.animLabeview;
}
@end
@@ -7,7 +7,9 @@
//
#import "GiGaBaseViewController.h"
#import "GiGaShareModel.h"
@interface ShareViewController : GiGaBaseViewController
@property(nonatomic,strong) GiGaShareModel *model;
@end
@@ -18,6 +18,8 @@
#import <WXApiObject.h>
#import <WXApi.h>
#import "UIImage+ShotImage.h"
#import "GiGaBaseAPiRequest.h"
#import "UIImageView+WebCache.h"
@interface ShareViewController ()<UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property(nonatomic,strong) UITableView *tab;
@@ -37,7 +39,7 @@
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
backBtn.frame = CGRectMake(20,44, 40, 40);
backBtn.frame = CGRectMake(20,20 +PhoneX_TopMargin, 40, 40);
[backBtn setImage:[UIImage imageNamed:@"btn_moment_back"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
@@ -46,6 +48,12 @@
[self creatBtns];
NC_ADD_TARGET_NAME_OBJECT(self, @selector(usershareSuccessNoti), NC_UseShareSuccessNoti, nil);
}
-(void)dealloc{
NC_REMOVE_NAME(self, NC_UseShareSuccessNoti, nil);
}
-(void)creatTabUI{
@@ -84,12 +92,23 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskTimeShareViewCell" owner:self options:nil] lastObject];
}
return cell;
}else if (indexPath.row == 1){
MaskShareTimeMidViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskShareTimeMidViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskShareTimeMidViewCell" owner:self options:nil] lastObject];
if (self.model) {
cell.timeLabe.text = self.model.minute;
CGFloat percent = [self.model.exquisite floatValue];
int perrr = percent * 100;
NSString *per = [NSString stringWithFormat:@"%d",perrr];
cell.percetLabe.text = per;
cell.totalLabe.text = self.model.totalMaskNum;
NSURL *url = [NSURL URLWithString:self.model.headImgUrl];
[cell.userAvtoar sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"nav_circle_avatar"]];
}
}
return cell;
}
@@ -161,7 +180,8 @@
//更换背景
-(void)changeAction{
MaskTimeShareActionSheet * sheet = [[MaskTimeShareActionSheet alloc] initWithFrame:CGRectMake(0, 0, KMainW, KMainH)];
MaskTimeShareActionSheet * sheet = [MaskTimeShareActionSheet showAtView:self];
[sheet show:^(NSUInteger index) {
switch (index) {
case 0:
@@ -176,10 +196,24 @@
if (self->_curentImageIndex == 4) {
self->_curentImageIndex = 0;
}
NSArray *images = @[@"sharebg_2",@"sharebg_3",@"sharebg_4",@"sharebg_5",@"sharebg_1"];
NSArray *images = @[@"sharebg_1",@"sharebg_2",@"sharebg_3",@"sharebg_4",@"sharebg_5"];
[self.backimageview setImage:[UIImage imageNamed: images[self->_curentImageIndex]]];
MaskTimeShareViewCell *cell = [self.tab cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
if (self.curentImageIndex==0) {
cell.shareLabe.image = [UIImage imageNamed:@"share_oneblack"];
cell.doinglabel.textColor = [UIColor blackColor];
}
if (self.curentImageIndex == 1) {
cell.shareLabe.image = [UIImage imageNamed:@"share_one"];
cell.doinglabel.textColor = GIGARGB(170, 170, 170, 1);
}
}
break;
case 2:
@@ -193,9 +227,7 @@
}
}];
[self.view addSubview:sheet];
}
#pragma mark 相册
@@ -307,6 +339,7 @@
// 朋友圈
[self shareImagToWX:image scene:WXSceneTimeline];
}
}];
}
@@ -330,4 +363,10 @@
[WXApi sendReq:req];
}
//分享成功
-(void)usershareSuccessNoti{
}
@end
@@ -74,10 +74,11 @@
CGFloat navH = SAFE_NAV_HEIGHT;
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];
[numberBtn setBackgroundImage:[UIImage imageNamed:@"result_logo"] forState:UIControlStateNormal];
// NSAttributedString *numbertitle = [[NSAttributedString alloc] initWithString:@"1" attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
//
//
// [numberBtn setAttributedTitle:numbertitle forState:UIControlStateNormal];
self.numberBtn = numberBtn;
[self.view addSubview:numberBtn];
@@ -85,16 +86,20 @@
titleLabel.text = @"悄悄地告诉你小优的年龄区间是?";
titleLabel.font = [UIFont fontWithName:GIGA_FONTBOLD size:16];
titleLabel.textColor = GIGARGB(63, 63, 63, 1);
titleLabel.numberOfLines = 2;
self.questionlabel = titleLabel;
[titleLabel sizeToFit];
[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.numberOfLines = 3;
descLabel.textAlignment = NSTextAlignmentCenter;
self.descLabel = descLabel;
[descLabel sizeToFit];
[self.view addSubview:descLabel];
[numberBtn mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -108,14 +113,14 @@
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);
make.right.mas_equalTo(self.view.mas_right).offset(-50);
}];
@@ -305,9 +310,9 @@
-(void)reloadViews{
//刷新问题相关数据
NSAttributedString *numbertitle = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld",(long)_page] attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[_numberBtn setAttributedTitle:numbertitle forState:UIControlStateNormal];
// NSAttributedString *numbertitle = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld",(long)_page] attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
//
// [_numberBtn setAttributedTitle:numbertitle forState:UIControlStateNormal];
self.questionlabel.text = [NSString stringWithFormat:@"%@",_currentModel.question];
self.descLabel.text = _currentModel.remark;
@@ -343,7 +348,7 @@
[self saveProgress];
if (_page == self.questonArray.count ) {
GIGA_ShowToast(@"没有了");
//GIGA_ShowToast(@"没有了");
[self submitAnswer];
return;
}
@@ -16,6 +16,7 @@
#import "GiGaFileNanager.h"
#import <WXApi.h>
#import "MaskTestResult.h"
#import "MaskTestNODataViewCell.h"
@interface MaskTestResultVC ()
@@ -42,11 +43,18 @@
[self.tableView registerClass:[MaskResultMinViewCell class] forCellReuseIdentifier:@"MaskResultMinViewCell"];
[self.tableView registerClass:[MaskResultShareViewCell class] forCellReuseIdentifier:@"MaskResultShareViewCell"];
if (!self.model) {
[self addNavTitile:@"历史测试"];
[self requstLatestTestData];
}
NC_ADD_TARGET_NAME_OBJECT(self, @selector(usershareSuccessNoti), NC_UseShareSuccessNoti, nil);
}
-(void)dealloc{
NC_REMOVE_NAME(self, NC_UseShareSuccessNoti, nil);
}
-(void)requstLatestTestData{
@@ -75,11 +83,24 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (self.model == nil) {
return 1;
}
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.model == nil) {
MaskTestNODataViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskTestNODataViewCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskTestNODataViewCell" owner:self options:nil] lastObject];
}
[cell.testBtn addTarget:self action:@selector(testBtnAction) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
if (indexPath.row == 0) {
static NSString *cellID = @"MaskResultPercentCell";
MaskResultPercentCell *cell =[tableView dequeueReusableCellWithIdentifier:cellID];
@@ -114,6 +135,10 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.model == nil) {
return 255;
}
CGFloat viewH = KMainH - SAFE_NAV_HEIGHT;
CGFloat cellH = viewH / 3 ;
return cellH;
@@ -182,6 +207,15 @@
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//分享成功
-(void)usershareSuccessNoti{
}
-(void)testBtnAction{
[self.navigationController popToRootViewControllerAnimated:YES];
}
@end
@@ -62,7 +62,7 @@
NSArray *colorArr = @[(id)[[UIColor colorWithHex:0xFFFFFF] CGColor],
(id)[[UIColor colorWithHex:0xFFF3E4] CGColor],
(id)[[UIColor colorWithHex:0x9A9996] CGColor]];
(id)[[UIColor colorWithHex:0xFBC37B] CGColor]];
NSArray *colorLocationArray = @[@0.0, @0.5, @1];
CAGradientLayer * gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = self.bounds;
@@ -0,0 +1,14 @@
//
// MaskTestNODataViewCell.h
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MaskTestNODataViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIButton *testBtn;
@end
@@ -0,0 +1,27 @@
//
// MaskTestNODataViewCell.m
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "MaskTestNODataViewCell.h"
@implementation MaskTestNODataViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.testBtn.layer.masksToBounds = YES;
self.testBtn.layer.cornerRadius = self.testBtn.frame.size.height /2 ;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,60 @@
<?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="none" indentationWidth="10" reuseIdentifier="MaskTestNODataViewCell" id="KGk-i7-Jjw" customClass="MaskTestNODataViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="255"/>
<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="254.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lm9-j5-N2R">
<rect key="frame" x="97" y="115" width="126" height="65"/>
<constraints>
<constraint firstAttribute="height" constant="65" id="38X-Cc-rhW"/>
<constraint firstAttribute="width" constant="126" id="d9e-ST-XY6"/>
</constraints>
<string key="text">还没有测试记录
快测测肤质吧</string>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<color key="textColor" red="0.41568627450000001" green="0.41568627450000001" blue="0.41568627450000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SPr-Bd-mHF">
<rect key="frame" x="94" y="196" width="132" height="41"/>
<color key="backgroundColor" red="0.70980392160000005" green="0.054901960780000002" blue="0.054901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="132" id="mEU-iC-bBa"/>
<constraint firstAttribute="height" constant="41" id="szc-TX-R5l"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<state key="normal" title="测试肤质"/>
</button>
</subviews>
<constraints>
<constraint firstItem="Lm9-j5-N2R" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="5RG-7U-vcz"/>
<constraint firstItem="SPr-Bd-mHF" firstAttribute="top" secondItem="Lm9-j5-N2R" secondAttribute="bottom" constant="16" id="ULk-kk-GV7"/>
<constraint firstItem="Lm9-j5-N2R" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="115" id="aYP-OA-woj"/>
<constraint firstItem="SPr-Bd-mHF" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="gJY-SL-6hY"/>
<constraint firstAttribute="bottom" secondItem="SPr-Bd-mHF" secondAttribute="bottom" constant="17.5" id="iso-5M-RBe"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="testBtn" destination="SPr-Bd-mHF" id="t1Y-Ap-CkT"/>
</connections>
<point key="canvasLocation" x="34" y="53.5"/>
</tableViewCell>
</objects>
</document>
+21
View File
@@ -0,0 +1,21 @@
//
// GiGaShareModel.h
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <JSONModel/JSONModel.h>
@interface GiGaShareModel : JSONModel
@property(nonatomic,copy) NSString *exquisite;
@property(nonatomic,copy) NSString *exquisitePercent;
@property(nonatomic,copy) NSString *headImgUrl;
@property(nonatomic,copy) NSString *minute;
@property(nonatomic,copy) NSString *monthMaskNum;
@property(nonatomic,copy) NSString *msg;
@property(nonatomic,copy) NSString *totalMaskNum;
@end
+18
View File
@@ -0,0 +1,18 @@
//
// GiGaShareModel.m
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaShareModel.h"
@implementation GiGaShareModel
+ (BOOL)propertyIsOptional:(NSString *)propertyName{
return YES;
}
@end
+44 -30
View File
@@ -25,7 +25,8 @@
self.frame = CGRectMake(0, 0, 0, height);
_msgModel = model;
//self.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.5];
self.backgroundColor = [UIColor redColor];
//self.backgroundColor = [UIColor redColor];
[self initUI];
}
return self;
@@ -40,43 +41,48 @@
-(void)initUI{
UIImageView *avatar = [[UIImageView alloc] init];
avatar.layer.masksToBounds = YES;
avatar.layer.cornerRadius = 15;
[self addSubview:avatar];
[avatar sd_setImageWithURL:[NSURL URLWithString:_msgModel.sendUserHeadImg] placeholderImage:[UIImage imageNamed:@"nav_circle_avatar"]];
self.userAvtar = avatar;
[self.userAvtar mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(30);
make.height.mas_equalTo(30);
make.left.mas_equalTo(self.mas_left).mas_offset(3);
make.top.mas_equalTo(self.mas_top).mas_offset(3);
}];
// UIImageView *avatar = [[UIImageView alloc] init];
// avatar.layer.masksToBounds = YES;
// avatar.layer.cornerRadius = 15;
// [self addSubview:avatar];
// [avatar sd_setImageWithURL:[NSURL URLWithString:_msgModel.sendUserHeadImg] placeholderImage:[UIImage imageNamed:@"nav_circle_avatar"]];
// self.userAvtar = avatar;
// [self.userAvtar mas_makeConstraints:^(MASConstraintMaker *make) {
// make.width.mas_equalTo(30);
// make.height.mas_equalTo(30);
// make.left.mas_equalTo(self.mas_left).mas_offset(3);
// make.top.mas_equalTo(self.mas_top).mas_offset(3);
//
// }];
UILabel *namelabel = [[UILabel alloc] init];
namelabel.font = [UIFont systemFontOfSize:14];
namelabel.textColor = [UIColor blackColor];
namelabel.font = GIGA_TEXTFONTBOLD(15);
namelabel.textColor = [UIColor whiteColor];
//namelabel.frame= CGRectMake(CGRectGetMaxX(avatar.frame) + 5, 4, namelabel.frame.size.width, namelabel.frame.size.height);
namelabel.text = @"用户名";
namelabel.text = @"用户名:";
if (_msgModel.sendUserName && _msgModel.sendUserName.length > 0) {
namelabel.text = [_msgModel.sendUserName replaceUnicode:_msgModel.sendUserName];
namelabel.text = [NSString stringWithFormat:@"%@:",_msgModel.sendUserName];
}
[namelabel sizeToFit];
self.userName = namelabel;
[self addSubview:self.userName];
// [self.userName mas_makeConstraints:^(MASConstraintMaker *make) {
//
// make.left.mas_equalTo(self.userAvtar.mas_right).mas_offset(3);
// make.top.mas_equalTo(self.mas_top).mas_offset(10);
//
// }];
[self.userName mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.mas_left).offset(3);
make.centerY.mas_equalTo(self.mas_centerY);
make.left.mas_equalTo(self.userAvtar.mas_right).mas_offset(3);
make.top.mas_equalTo(self.mas_top).mas_offset(10);
}];
UILabel *msglabel = [[UILabel alloc] init];
msglabel.font = [UIFont systemFontOfSize:13];
msglabel.textColor = [UIColor blackColor];
msglabel.font = GIGA_TEXTFONTMEDIUM(13);
msglabel.textColor = [UIColor whiteColor];
//msglabel.frame= CGRectMake(namelabel.frame.origin.x, CGRectGetMaxY(avatar.frame) - msglabel.frame.size.height - namelabel.frame.origin.y, msglabel.frame.size.width, msglabel.frame.size.height);
msglabel.text = @"信息内容";
if (_msgModel.content && _msgModel.content.length > 0) {
msglabel.text = [_msgModel.content replaceUnicode:_msgModel.content];
@@ -84,17 +90,25 @@
self.msg = msglabel;
[msglabel sizeToFit];
[self addSubview:self.msg];
// [self.msg mas_makeConstraints:^(MASConstraintMaker *make) {
//
// make.top.mas_equalTo(self.userAvtar.mas_bottom).mas_offset(3);
// make.left.mas_equalTo(self.mas_left).mas_offset(5);
//
// }];
[self.msg mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.userAvtar.mas_bottom).mas_offset(3);
make.left.mas_equalTo(self.mas_left).mas_offset(5);
make.left.mas_equalTo(namelabel.mas_right).offset(2);
make.centerY.mas_equalTo(self.mas_centerY);
}];
[self layoutIfNeeded];
float width = msglabel.frame.size.width > namelabel.frame.size.width ? msglabel.frame.size.width:namelabel.frame.size.width ;
// float width = msglabel.frame.size.width > namelabel.frame.size.width ? msglabel.frame.size.width:namelabel.frame.size.width ;
float width = msglabel.frame.size.width + namelabel.frame.size.width;
self.frame = CGRectMake(0, 0, namelabel.frame.origin.x + 10 + width, self.frame.size.height);
self.frame = CGRectMake(0, 0, width, self.frame.size.height);
}
@end
@@ -16,7 +16,10 @@
}
-(void)comfirmTitles:(NSIndexPath *)indepath
{
NSArray *titles = @[@"手机相册",@"系统相册",@"自拍"];
NSArray *titles = @[@"手机相册",@"系统相册",@"自拍",@"取消"];
if (indepath.row == 3) {
self.sheetTitle.textColor = GIGARGB(165,165, 165, 1);
}
self.sheetTitle.text = titles[indepath.row];
}
@@ -14,5 +14,6 @@
@property (weak, nonatomic) IBOutlet UILabel *timeLabe;
@property (weak, nonatomic) IBOutlet UILabel *percetLabe;
@property (weak, nonatomic) IBOutlet UILabel *totalLabe;
@property (weak, nonatomic) IBOutlet UIImageView *userAvtoar;
@end
@@ -20,6 +20,9 @@
self.timeBackVIew.layer.shadowOffset = CGSizeMake(2,1);
self.timeBackVIew.layer.shadowColor = GIGARGB(91, 91, 91, 0.6).CGColor;
self.timeBackVIew.layer.shadowOpacity = 0.8;
self.userAvtoar.layer.masksToBounds = YES;
self.userAvtoar.layer.cornerRadius = 4;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
@@ -178,6 +178,7 @@
<outlet property="timeBackVIew" destination="H7C-wU-YeM" id="q2o-NG-UKS"/>
<outlet property="timeLabe" destination="znk-jF-QRT" id="pii-LG-rfu"/>
<outlet property="totalLabe" destination="ZJ1-li-JLb" id="MeX-lM-Wfv"/>
<outlet property="userAvtoar" destination="ocM-SZ-rcr" id="buS-pJ-uPg"/>
<outlet property="userIcon" destination="ocM-SZ-rcr" id="VxR-wi-5fs"/>
</connections>
<point key="canvasLocation" x="34" y="53.5"/>
@@ -7,9 +7,13 @@
//
#import <UIKit/UIKit.h>
typedef void (^actionSheetAction)(NSUInteger index);
@interface MaskTimeShareActionSheet : UIView
@interface MaskTimeShareActionSheet : UIViewController
@property(nonatomic,copy) actionSheetAction action;
-(void)show:(actionSheetAction)action;
+(MaskTimeShareActionSheet *)showAtView:(UIViewController *)vc;
@end
@@ -15,58 +15,55 @@
@implementation MaskTimeShareActionSheet
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; ;
[self creatUI];
}
return self;
- (void)viewDidLoad{
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.4];
[self creatUI];
}
-(void)creatUI{
UIView *holdview =[[UIView alloc] init];
holdview.frame =CGRectMake(0,KMainH - 216 - 60 -20 , KMainW, 216 + 60 +20);
holdview.backgroundColor = [UIColor whiteColor];
// CGRect backRect= holdview.frame;
//
holdview.frame =CGRectMake(0,KMainH - 216 , KMainW, 216);
holdview.backgroundColor = [UIColor whiteColor];
//CGRect backRect= holdview.frame;
// UIBezierPath *maskPath=[UIBezierPath bezierPathWithRoundedRect:backRect byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(15, 15)];
// CAShapeLayer *maskLayer =[[CAShapeLayer alloc] init];
// maskLayer.frame = backRect;
// maskLayer.path = maskPath.CGPath;
// holdview.layer.mask = maskLayer;
holdview.layer.masksToBounds = YES;
holdview.layer.cornerRadius = 10;
[self addSubview:holdview];
// holdview.layer.masksToBounds = YES;
// holdview.layer.cornerRadius = 10;
[self.view addSubview:holdview];
self.tabview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KMainW, 216 + 60) style:UITableViewStylePlain];
self.tabview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KMainW, 216) style:UITableViewStylePlain];
self.tabview.backgroundColor = [UIColor whiteColor];
self.tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tabview.delegate = self;
self.tabview.scrollEnabled = NO;
self.tabview.dataSource = self;
UIButton *cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
[cancleBtn setTitleColor:GIGARGB(165,165, 165, 1) forState:UIControlStateNormal];
[cancleBtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
cancleBtn.frame = CGRectMake(0,1, KMainW,60);
self.tabview.tableFooterView = cancleBtn;
[holdview addSubview:self.tabview];
}
+(MaskTimeShareActionSheet *)showAtView:(UIViewController *)vc{
MaskTimeShareActionSheet *Sheet = [[MaskTimeShareActionSheet alloc] init];
if (ISIOS8) {
Sheet.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}else{
Sheet.modalPresentationStyle = UIModalPresentationCurrentContext;
}
[vc presentViewController:Sheet animated:YES completion:nil];
return Sheet;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 3;
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
@@ -82,11 +79,16 @@
return 54;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (self.action) {
self.action(indexPath.row);
if (indexPath.row == 3) {
[self cancleDissmiss];
}else{
[self cancleDissmiss];
if (self.action) {
self.action(indexPath.row);
}
}
}
-(void)show:(actionSheetAction)action{
@@ -106,10 +108,8 @@
}
-(void)cancleDissmiss{
[UIView animateWithDuration:1.0 animations:^{
self.tabview.frame = CGRectMake(0, KMainH - 216, KMainW, 0);
}];
[self removeFromSuperview];
[self dismissViewControllerAnimated:NO completion:nil];
}
@@ -9,5 +9,7 @@
#import <UIKit/UIKit.h>
@interface MaskTimeShareViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *doinglabel;
@property (weak, nonatomic) IBOutlet UIImageView *shareLabe;
@end
@@ -41,7 +41,7 @@
<constraint firstAttribute="height" constant="35" id="zzS-Dk-zsi"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="share_one" translatesAutoresizingMaskIntoConstraints="NO" id="dlk-Er-Voj">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="share_oneblack" translatesAutoresizingMaskIntoConstraints="NO" id="dlk-Er-Voj">
<rect key="frame" x="42" y="229" width="162" height="19"/>
<constraints>
<constraint firstAttribute="height" constant="19" id="JLN-Jh-Gue"/>
@@ -63,12 +63,16 @@
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="doinglabel" destination="ajv-9T-Bcf" id="Le0-Q8-0zg"/>
<outlet property="shareLabe" destination="dlk-Er-Voj" id="iWt-Wf-6y7"/>
</connections>
<point key="canvasLocation" x="34" y="53.5"/>
</tableViewCell>
</objects>
<resources>
<image name="share_logo" width="185" height="85"/>
<image name="share_one" width="133" height="17"/>
<image name="share_oneblack" width="133" height="17"/>
<image name="share_two" width="155" height="35"/>
</resources>
</document>
@@ -57,7 +57,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="这是您敷面膜的第:10次" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o4N-kZ-Uph">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="这是您敷面膜的第:10张" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o4N-kZ-Uph">
<rect key="frame" x="193" y="17" width="111" height="14"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -19,33 +19,44 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="89.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gqo-NQ-qFy">
<rect key="frame" x="24" y="24" width="120" height="40"/>
<color key="backgroundColor" red="0.70980392156862748" green="0.054901960784313725" blue="0.054901960784313725" alpha="1" colorSpace="calibratedRGB"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="og4-sa-zcc">
<rect key="frame" x="12" y="5" width="297" height="78"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gqo-NQ-qFy">
<rect key="frame" x="15" y="19" width="120" height="40"/>
<color key="backgroundColor" red="0.70980392156862748" green="0.054901960784313725" blue="0.054901960784313725" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="fbO-WJ-dOx"/>
<constraint firstAttribute="height" constant="40" id="j7c-6V-Nkv"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<state key="normal" title="更换背景"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="scf-Jn-nCG">
<rect key="frame" x="163" y="19" width="120" height="40"/>
<color key="backgroundColor" red="0.70980392160000005" green="0.054901960780000002" blue="0.054901960780000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="IbN-g5-5Dk"/>
<constraint firstAttribute="height" constant="40" id="YlE-4r-yHL"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<state key="normal" title="分享"/>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="TPM-XU-L0w"/>
<constraint firstAttribute="width" constant="120" id="ZPK-wp-9E9"/>
<constraint firstAttribute="height" constant="78" id="DO7-hs-rG7"/>
<constraint firstAttribute="width" constant="297" id="J73-5q-ui5"/>
<constraint firstItem="Gqo-NQ-qFy" firstAttribute="centerY" secondItem="og4-sa-zcc" secondAttribute="centerY" id="KLB-Wx-4AS"/>
<constraint firstItem="Gqo-NQ-qFy" firstAttribute="leading" secondItem="og4-sa-zcc" secondAttribute="leading" constant="15" id="QzO-BI-GP4"/>
<constraint firstItem="scf-Jn-nCG" firstAttribute="centerY" secondItem="og4-sa-zcc" secondAttribute="centerY" id="cgO-tC-6O7"/>
<constraint firstAttribute="trailing" secondItem="scf-Jn-nCG" secondAttribute="trailing" constant="14" id="twO-fW-Eua"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<state key="normal" title="更换背景"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="scf-Jn-nCG">
<rect key="frame" x="176" y="24" width="120" height="40"/>
<color key="backgroundColor" red="0.70980392160000005" green="0.054901960780000002" blue="0.054901960780000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Yva-pt-o9N"/>
<constraint firstAttribute="width" constant="120" id="mNM-uk-QUs"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="18"/>
<state key="normal" title="分享"/>
</button>
</view>
</subviews>
<constraints>
<constraint firstItem="scf-Jn-nCG" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Gqo-NQ-qFy" secondAttribute="trailing" constant="32" id="MSN-NY-psb"/>
<constraint firstItem="scf-Jn-nCG" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="fxv-dG-WQl"/>
<constraint firstAttribute="trailing" secondItem="scf-Jn-nCG" secondAttribute="trailing" constant="24" id="iv9-Dq-7bp"/>
<constraint firstItem="Gqo-NQ-qFy" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="sta-hl-p4d"/>
<constraint firstItem="Gqo-NQ-qFy" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="24" id="y1w-d5-yav"/>
<constraint firstItem="og4-sa-zcc" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="dvj-W6-RMX"/>
<constraint firstItem="og4-sa-zcc" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="kRr-5g-gSI"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
@@ -13,5 +13,6 @@
@property (weak, nonatomic) IBOutlet UILabel *timeLabe;
@property (weak, nonatomic) IBOutlet UILabel *percentLabe;
@property (weak, nonatomic) IBOutlet UILabel *totalTime;
@property (weak, nonatomic) IBOutlet UIImageView *useravator;
@end
@@ -19,6 +19,8 @@
self.timeholdBack.layer.shadowColor = GIGARGB(233, 226, 226, 1).CGColor;
self.timeholdBack.layer.shadowOpacity = 1;
//self.timeholdBack.layer.shadowRadius = 6;
self.useravator.layer.masksToBounds = YES;
self.useravator.layer.cornerRadius = 4;
}
@@ -105,13 +105,13 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="%的用户" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Kf-o0-1q0">
<rect key="frame" x="171.5" y="139" width="48" height="17"/>
<rect key="frame" x="175.5" y="139" width="48" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.21568627450980393" green="0.21568627450980393" blue="0.21568627450980393" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="min" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dic-3G-CvO">
<rect key="frame" x="307" y="139" width="21" height="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="张" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dic-3G-CvO">
<rect key="frame" x="311" y="139" width="21" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="7vV-ZK-S0b"/>
<constraint firstAttribute="width" constant="21" id="8AJ-vw-Jnl"/>
@@ -137,16 +137,16 @@
<constraint firstItem="dic-3G-CvO" firstAttribute="top" secondItem="j6s-4L-8FL" secondAttribute="bottom" constant="33" id="Ht3-2Y-5Mb"/>
<constraint firstItem="Tme-2V-NlI" firstAttribute="top" secondItem="R09-WA-3qM" secondAttribute="bottom" constant="26" id="KUx-Nw-4kf"/>
<constraint firstItem="R09-WA-3qM" firstAttribute="top" secondItem="tEV-Hx-dgE" secondAttribute="top" constant="61" id="LNc-ql-jSY"/>
<constraint firstAttribute="trailing" secondItem="dic-3G-CvO" secondAttribute="trailing" constant="13" id="Lb3-Ut-P6Z"/>
<constraint firstAttribute="trailing" secondItem="dic-3G-CvO" secondAttribute="trailing" constant="9" id="Lb3-Ut-P6Z"/>
<constraint firstItem="8Kf-o0-1q0" firstAttribute="top" secondItem="Tme-2V-NlI" secondAttribute="bottom" constant="33" id="Lev-qu-Zmr"/>
<constraint firstItem="xEv-bM-Qny" firstAttribute="top" secondItem="Tme-2V-NlI" secondAttribute="bottom" constant="4" id="P0c-5d-JJq"/>
<constraint firstItem="UA6-7v-cad" firstAttribute="leading" secondItem="tEV-Hx-dgE" secondAttribute="leading" constant="19" id="Tzt-3x-Lfy"/>
<constraint firstAttribute="trailing" secondItem="Yg7-YX-5c6" secondAttribute="trailing" constant="14" id="Usm-zC-hhp"/>
<constraint firstItem="8Kf-o0-1q0" firstAttribute="leading" secondItem="xEv-bM-Qny" secondAttribute="trailing" constant="-1" id="VD9-bi-F2d"/>
<constraint firstItem="8Kf-o0-1q0" firstAttribute="leading" secondItem="xEv-bM-Qny" secondAttribute="trailing" constant="3" id="VD9-bi-F2d"/>
<constraint firstItem="Yd8-h2-8ZW" firstAttribute="top" secondItem="j6s-4L-8FL" secondAttribute="bottom" constant="3" id="XWR-b8-Nl1"/>
<constraint firstItem="SKr-dU-xbP" firstAttribute="top" secondItem="TkO-iO-bzM" secondAttribute="bottom" constant="4" id="lYD-5E-uY3"/>
<constraint firstItem="UA6-7v-cad" firstAttribute="top" secondItem="tEV-Hx-dgE" secondAttribute="top" constant="10" id="mLH-mh-9mJ"/>
<constraint firstItem="dic-3G-CvO" firstAttribute="leading" secondItem="Yd8-h2-8ZW" secondAttribute="trailing" constant="-3" id="rVx-wc-qRN"/>
<constraint firstItem="dic-3G-CvO" firstAttribute="leading" secondItem="Yd8-h2-8ZW" secondAttribute="trailing" constant="1" id="rVx-wc-qRN"/>
<constraint firstItem="5p1-hF-pIU" firstAttribute="leading" secondItem="SKr-dU-xbP" secondAttribute="trailing" constant="8" id="sm5-de-qgC"/>
<constraint firstItem="Yg7-YX-5c6" firstAttribute="top" secondItem="tEV-Hx-dgE" secondAttribute="top" constant="20" id="vNY-Db-SYT"/>
<constraint firstItem="j6s-4L-8FL" firstAttribute="top" secondItem="R09-WA-3qM" secondAttribute="bottom" constant="26" id="xu2-eN-sWL"/>
@@ -166,6 +166,7 @@
<outlet property="timeLabe" destination="SKr-dU-xbP" id="LAX-mi-LrF"/>
<outlet property="timeholdBack" destination="tEV-Hx-dgE" id="oFa-dy-K2h"/>
<outlet property="totalTime" destination="Yd8-h2-8ZW" id="3pB-KH-2ui"/>
<outlet property="useravator" destination="UA6-7v-cad" id="Wyb-DM-w0i"/>
</connections>
<point key="canvasLocation" x="33.5" y="53.5"/>
</tableViewCell>
@@ -0,0 +1,27 @@
//
// MaskTimeTopAnimationView.h
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MaskTimeTopAnimationView;
@protocol MaskTimeTextViewDelegate <NSObject>
@optional
- (void)gyChangeTextView:(MaskTimeTopAnimationView *)textView didTapedAtIndex:(NSInteger)index;
@end
@interface MaskTimeTopAnimationView : UIView
@property (nonatomic, assign) id<MaskTimeTextViewDelegate> delegate;
- (void)animationWithTexts:(NSArray *)textAry;
- (void)stopAnimation;
@end
@@ -0,0 +1,131 @@
//
// MaskTimeTopAnimationView.m
// GIGA
//
// Created by lianxiang on 2018/9/26.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "MaskTimeTopAnimationView.h"
#define DEALY_WHEN_TITLE_IN_MIDDLE 5.0
#define DEALY_WHEN_TITLE_IN_BOTTOM 0.0
typedef NS_ENUM(NSUInteger, GYTitlePosition) {
GYTitlePositionTop = 1,
GYTitlePositionMiddle = 2,
GYTitlePositionBottom = 3
};
@interface MaskTimeTopAnimationView()
@property (nonatomic, strong) UILabel *textLabel;
@property (nonatomic, strong) NSArray *contentsAry;
@property (nonatomic, assign) CGPoint topPosition;
@property (nonatomic, assign) CGPoint middlePosition;
@property (nonatomic, assign) CGPoint bottomPosition;
/*
*1.控制延迟时间,当文字在中间时,延时时间长一些,如5秒,这样可以让用户浏览清楚内容;
*2.当文字隐藏在底部的时候,不需要延迟,这样衔接才流畅;
*3.通过上面的宏定义去更改需要的值
*/
@property (nonatomic, assign) CGFloat needDealy;
@property (nonatomic, assign) NSInteger currentIndex; /*当前播放到那个标题了*/
@property (nonatomic, assign) BOOL shouldStop; /*是否停止*/
@end
@implementation MaskTimeTopAnimationView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
//self.backgroundColor = [UIColor whiteColor];
self.topPosition = CGPointMake(self.frame.size.width/2 -22, -self.frame.size.height/2);
self.middlePosition = CGPointMake(self.frame.size.width/2 - 22, self.frame.size.height/2);
self.bottomPosition = CGPointMake(self.frame.size.width/2 -22 , self.frame.size.height/2*3);
self.shouldStop = NO;
_textLabel = [[UILabel alloc] init];
//_textLabel.backgroundColor = [UIColor blackColor];
_textLabel.layer.bounds = CGRectMake(0,0, CGRectGetWidth(frame), CGRectGetHeight(frame));
_textLabel.layer.position = self.middlePosition;
_textLabel.textAlignment = NSTextAlignmentCenter;
_textLabel.textColor = [UIColor whiteColor];
_textLabel.font = GIGA_TEXTFONTMEDIUM(13);
[self.layer addSublayer:_textLabel.layer];
self.clipsToBounds = NO; /*保证文字不跑出视图YES*/
self.needDealy = DEALY_WHEN_TITLE_IN_MIDDLE; /*控制第一次显示时间*/
self.currentIndex = 0;
}
return self;
}
- (void)animationWithTexts:(NSArray *)textAry {
self.contentsAry = textAry;
self.textLabel.text = [textAry objectAtIndex:0];
//[self.textLabel sizeToFit];
[self startAnimation];
}
- (void)startAnimation {
__weak typeof(self) weakSelf = self;
[UIView animateWithDuration:0.3 delay:self.needDealy options:UIViewAnimationOptionCurveEaseInOut animations:^{
if ([weakSelf currentTitlePosition] == GYTitlePositionMiddle) {
weakSelf.textLabel.layer.position = weakSelf.topPosition;
} else if ([weakSelf currentTitlePosition] == GYTitlePositionBottom) {
weakSelf.textLabel.layer.position = weakSelf.middlePosition;
}
} completion:^(BOOL finished) {
if ([weakSelf currentTitlePosition] == GYTitlePositionTop) {
weakSelf.textLabel.layer.position = weakSelf.bottomPosition;
weakSelf.needDealy = DEALY_WHEN_TITLE_IN_BOTTOM;
weakSelf.currentIndex ++;
weakSelf.textLabel.text = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
} else {
weakSelf.needDealy = DEALY_WHEN_TITLE_IN_MIDDLE;
}
if (!weakSelf.shouldStop) {
[weakSelf startAnimation];
} else { //停止动画后,要设置label位置和label显示内容
weakSelf.textLabel.layer.position = weakSelf.middlePosition;
weakSelf.textLabel.text = [weakSelf.contentsAry objectAtIndex:[weakSelf realCurrentIndex]];
}
}];
}
- (void)stopAnimation {
self.shouldStop = YES;
}
- (NSInteger)realCurrentIndex {
return self.currentIndex % [self.contentsAry count];
}
- (GYTitlePosition)currentTitlePosition {
if (self.textLabel.layer.position.y == self.topPosition.y) {
return GYTitlePositionTop;
} else if (self.textLabel.layer.position.y == self.middlePosition.y) {
return GYTitlePositionMiddle;
}
return GYTitlePositionBottom;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
if ([self.delegate respondsToSelector:@selector(gyChangeTextView:didTapedAtIndex:)]) {
[self.delegate gyChangeTextView:self didTapedAtIndex:[self realCurrentIndex]];
}
}
//- (CGSize)intrinsicContentSize
//
//{
//
// return UILayoutFittingExpandedSize;
//
//}
@end