Commit c7852c20 by xuning

订单详情拖动

parent 8de2bacd
......@@ -43,6 +43,9 @@
799DF11A2B6D2B3200680907 /* XVLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 799DF1192B6D2B3200680907 /* XVLoginViewController.m */; };
79DC8B6F2B74A8E600DBD8EA /* XVPersonalFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DC8B6E2B74A8E600DBD8EA /* XVPersonalFooterView.m */; };
79DC8B722B74B3EC00DBD8EA /* XVOrderSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DC8B712B74B3EC00DBD8EA /* XVOrderSettingViewController.m */; };
79DC8B752B74B69600DBD8EA /* XVOrderDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DC8B742B74B69600DBD8EA /* XVOrderDetailsViewController.m */; };
79DC8B782B74B78A00DBD8EA /* XVOrderInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DC8B772B74B78A00DBD8EA /* XVOrderInfoViewController.m */; };
79DC8B7B2B7AF42800DBD8EA /* XVOrderInfoTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 79DC8B7A2B7AF42800DBD8EA /* XVOrderInfoTopView.m */; };
FA5E55D5A48FDC04BA4CCD08 /* Pods_fastservice.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08D109EE60B32403F3655A70 /* Pods_fastservice.framework */; };
/* End PBXBuildFile section */
......@@ -122,6 +125,12 @@
79DC8B6E2B74A8E600DBD8EA /* XVPersonalFooterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XVPersonalFooterView.m; sourceTree = "<group>"; };
79DC8B702B74B3EC00DBD8EA /* XVOrderSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XVOrderSettingViewController.h; sourceTree = "<group>"; };
79DC8B712B74B3EC00DBD8EA /* XVOrderSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XVOrderSettingViewController.m; sourceTree = "<group>"; };
79DC8B732B74B69600DBD8EA /* XVOrderDetailsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XVOrderDetailsViewController.h; sourceTree = "<group>"; };
79DC8B742B74B69600DBD8EA /* XVOrderDetailsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XVOrderDetailsViewController.m; sourceTree = "<group>"; };
79DC8B762B74B78A00DBD8EA /* XVOrderInfoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XVOrderInfoViewController.h; sourceTree = "<group>"; };
79DC8B772B74B78A00DBD8EA /* XVOrderInfoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XVOrderInfoViewController.m; sourceTree = "<group>"; };
79DC8B792B7AF42800DBD8EA /* XVOrderInfoTopView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XVOrderInfoTopView.h; sourceTree = "<group>"; };
79DC8B7A2B7AF42800DBD8EA /* XVOrderInfoTopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XVOrderInfoTopView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -171,6 +180,10 @@
7981EACE2B6F63CF00F357E7 /* XVMainJobViewController.m */,
7981EAD72B6FB53E00F357E7 /* XVNewJobViewController.h */,
7981EAD82B6FB53E00F357E7 /* XVNewJobViewController.m */,
79DC8B732B74B69600DBD8EA /* XVOrderDetailsViewController.h */,
79DC8B742B74B69600DBD8EA /* XVOrderDetailsViewController.m */,
79DC8B762B74B78A00DBD8EA /* XVOrderInfoViewController.h */,
79DC8B772B74B78A00DBD8EA /* XVOrderInfoViewController.m */,
);
path = Controller;
sourceTree = "<group>";
......@@ -188,6 +201,8 @@
7981EAF82B71205A00F357E7 /* XVJobStatusToolView.m */,
7981EAFA2B71272D00F357E7 /* XVNewJobViewCell.h */,
7981EAFB2B71272D00F357E7 /* XVNewJobViewCell.m */,
79DC8B792B7AF42800DBD8EA /* XVOrderInfoTopView.h */,
79DC8B7A2B7AF42800DBD8EA /* XVOrderInfoTopView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -543,15 +558,18 @@
buildActionMask = 2147483647;
files = (
79DC8B6F2B74A8E600DBD8EA /* XVPersonalFooterView.m in Sources */,
79DC8B752B74B69600DBD8EA /* XVOrderDetailsViewController.m in Sources */,
7981EAB72B6E669000F357E7 /* UIScrollView+XVAdd.m in Sources */,
7981EACF2B6F63CF00F357E7 /* XVMainJobViewController.m in Sources */,
799DF1042B6D220300680907 /* XVBaseViewController.m in Sources */,
799DF0C62B6BD8AF00680907 /* AppDelegate.m in Sources */,
7981EAC72B6F41B000F357E7 /* XVRegisterViewController.m in Sources */,
79DC8B7B2B7AF42800DBD8EA /* XVOrderInfoTopView.m in Sources */,
799DF1112B6D25B400680907 /* NSObject+SXRuntime.m in Sources */,
7981EABA2B6E670200F357E7 /* UIView+XVAdd.m in Sources */,
7981EAD32B6F656900F357E7 /* XVCustomBarView.m in Sources */,
7981EACA2B6F59E800F357E7 /* XVPasswordViewController.m in Sources */,
79DC8B782B74B78A00DBD8EA /* XVOrderInfoViewController.m in Sources */,
7981EABD2B6E675F00F357E7 /* NSString+XVAdd.m in Sources */,
799DF0F72B6BDA1400680907 /* BRPlaceholderTextView.m in Sources */,
79DC8B722B74B3EC00DBD8EA /* XVOrderSettingViewController.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fas fa-map-marker@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fas fa-map-marker1@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "if-phone-circle Copy@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "if-phone-circle@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -47,6 +47,43 @@
@implementation UIScrollView (XVAdd)
//重写touchesBegin方法
//
//-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//
// //主要代码实现:
//
// [[self nextResponder] touchesBegan:touches withEvent:event];
//
// //super调用,别漏
//
// [super touchesBegan:touches withEvent:event];
//
//}
//
//
//
////重写touchesEnded方法
//
//- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
//
// [[self nextResponder] touchesEnded:touches withEvent:event];
//
// [super touchesEnded:touches withEvent:event];
//
//}
//
//
//
////重写touchesMoved方法
//
//-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
//
// [[self nextResponder] touchesMoved:touches withEvent:event];
//
// [super touchesMoved:touches withEvent:event];
//
//}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ([self panBack:gestureRecognizer]) {
......
......@@ -24,6 +24,7 @@
@property (nonatomic, strong) XVOrderSortView *sortView;
@property (nonatomic,assign) NSInteger currentIndex;
@end
......@@ -54,7 +55,7 @@
// 点击选中的情况才会调用该方法
- (void)categoryView:(JXCategoryBaseView *)categoryView didClickSelectedItemAtIndex:(NSInteger)index {
if (index == 0 && categoryView.selectedIndex == 0) {
if (self.currentIndex == 0 && index == 0 && categoryView.selectedIndex == 0) {
self.sortView.backgroundColor = [UIColor whiteColor];
if(self.sortView.hidden) {
......@@ -72,6 +73,7 @@
// 路线规划
}
self.currentIndex = index;
......@@ -154,7 +156,7 @@
if(_listContainerView == nil) {
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_listContainerView.frame = CGRectMake(0, self.barView.height + 50, SCREEN_WIDTH, SCREEN_HEIGHT-self.barView.height - 50);
_listContainerView.scrollView.scrollEnabled = YES;
_listContainerView.scrollView.scrollEnabled = NO;
}
return _listContainerView;
}
......
......@@ -7,6 +7,7 @@
//
#import "XVNewJobViewController.h"
#import "XVOrderDetailsViewController.h"
#import "XVJobStatusToolView.h"
#import "XVNewJobViewCell.h"
......@@ -30,7 +31,7 @@
}
- (void)viewDidLoad {
[super viewDidLoad];
// [[NSUserDefaults standardUserDefaults] setValue:@(YES) forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 100;
......@@ -61,7 +62,7 @@
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view).mas_offset(51);
make.top.mas_equalTo(self.searchField.mas_bottom).mas_offset(6);
make.left.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom).mas_offset(-61);
}];
......@@ -82,6 +83,9 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
XVOrderDetailsViewController *vc = [[XVOrderDetailsViewController alloc]init];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)textFieldDidChange:(UITextField *)textField {
......
//
// XVOrderDetailsViewController.h
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XVOrderDetailsViewController : XVBaseViewController
@end
NS_ASSUME_NONNULL_END
//
// XVOrderDetailsViewController.m
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVOrderDetailsViewController.h"
#import "XVOrderInfoViewController.h"
@interface XVOrderDetailsViewController ()<UIGestureRecognizerDelegate>
@property (nonatomic, strong) XVOrderInfoViewController *infoVc;
@property (nonatomic, assign) CGPoint containerOrigin;
@property (nonatomic, assign) NSInteger lastPos;
@end
@implementation XVOrderDetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
}
- (void)setupUI {
[self.view addSubview:self.infoVc.view];
self.infoVc.view.frame = CGRectMake(0, 361, SCREEN_WIDTH, SCREEN_HEIGHT);
[self addChildViewController:self.infoVc];
self.infoVc.scrollView.scrollEnabled = NO;
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGestureRecognized:)];
pan.delegate = self;
[self.infoVc.view addGestureRecognizer:pan];
}
- (void)panGestureRecognized:(UIPanGestureRecognizer *)pan {
UIView *view = pan.view;
CGPoint offset = [pan translationInView:self.view];
if(offset.y > 0 && self.infoVc.view.top == 361) {
return;
}
if(view.top <= 0) {
view.top = 0;
}else{
view.top += offset.y;
}
Log(@"%f===%ld",view.top,(long)pan.state);
if(pan.state == UIGestureRecognizerStateEnded) {
if ([pan velocityInView:self.view].y < 0) {
if(view.top <= 90) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 0;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = YES;
}];
}else if(view.top <= 270 && view.top > 90) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 180;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = NO;
}];
}else if(view.top > 270) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 361;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = NO;
}];
}
}else{
if(view.top == 0) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 180;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = NO;
}];
}else if(view.top <= 270 && view.top > 90) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 180;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = NO;
}];
}else if(view.top > 270) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 361;
} completion:^(BOOL finished) {
self.infoVc.scrollView.contentOffset = CGPointMake(0, 0);
self.infoVc.scrollView.scrollEnabled = NO;
}];
}
}
}
[pan setTranslation:CGPointZero inView:view];}
// 实现UIGestureRecognizerDelegate代理方法 , 返回YES表示支持多个手势同时触发,否则不允许多个手势同时触发
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
UIScrollView *tab = (UIScrollView *)[otherGestureRecognizer view];
CGPoint vel = [tab.panGestureRecognizer velocityInView:tab];
if (vel.y > 0) {
// 下拉 , 只有当contentOffset.y为0时才允许多手势同时触发
CGPoint Point= tab.contentOffset;
return Point.y == 0;
}else{
// 上拉
return NO;
}
}
return NO;
}
- (XVOrderInfoViewController *)infoVc {
if(_infoVc == nil) {
_infoVc = [[XVOrderInfoViewController alloc]init];
}
return _infoVc;
}
@end
//
// XVOrderInfoViewController.h
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XVOrderInfoViewController : XVBaseViewController
@property (nonatomic, strong) UIScrollView *scrollView;
//- (void)resetScrollViewUserEnabled:(BOOL)enabled;
@end
NS_ASSUME_NONNULL_END
//
// XVOrderInfoViewController.m
// fastservice
//
// Created by xuning on 2/8/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVOrderInfoViewController.h"
#import "XVOrderInfoTopView.h"
#define ORIGIN_Y_MIN 0
#define ORIGIN_Y_MID 180
#define ORIGIN_Y_MAX 360
@interface XVOrderInfoViewController ()<UIGestureRecognizerDelegate>
@property (nonatomic, assign) NSInteger lastPos;
@property (nonatomic,assign) BOOL isDelay;
@property (nonatomic, strong) XVOrderInfoTopView *topView;
@end
@implementation XVOrderInfoViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
//
// UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePan:)];
// pan.delegate = self;
// [self.view addGestureRecognizer:pan];
}
- (void)handlePan:(UIPanGestureRecognizer *)pan {
UIView *view = pan.view;
CGPoint offset = [pan translationInView:self.view];
if(offset.y > 0 && self.view.top == 361) {
return;
}
if(view.top <= 0) {
view.top = 0;
}else{
view.top += offset.y;
}
Log(@"%f===%ld",view.top,(long)pan.state);
if(pan.state == UIGestureRecognizerStateEnded) {
if(view.top <= 90) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 0;
} completion:^(BOOL finished) {
self.scrollView.contentOffset = CGPointMake(0, 0);
self.scrollView.scrollEnabled = YES;
}];
}else if(view.top <= 270 && view.top > 90) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 180;
} completion:^(BOOL finished) {
self.scrollView.contentOffset = CGPointMake(0, 0);
self.scrollView.scrollEnabled = NO;
}];
}else if(view.top > 270) {
[UIView animateWithDuration:0.3 animations:^{
view.top = 361;
} completion:^(BOOL finished) {
self.scrollView.contentOffset = CGPointMake(0, 0);
self.scrollView.scrollEnabled = NO;
}];
}
}
[pan setTranslation:CGPointZero inView:view];
}
// 实现UIGestureRecognizerDelegate代理方法,返回YES表示支持多个手势同时触发,否则不允许多个手势同时触发
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
if ([otherGestureRecognizer.view isKindOfClass:[UIScrollView class]]) {
UIScrollView *tab = (UIScrollView *)[otherGestureRecognizer view];
CGPoint vel = [tab.panGestureRecognizer velocityInView:tab];
if (vel.y > 0) {
// 下拉 , 只有当contentOffset.y为0时才允许多手势同时触发
CGPoint Point= tab.contentOffset;
return Point.y == 0;
}else{
// 上拉
return NO;
}
}
return NO;
}
- (void)setupUI {
[self.view addSubview:self.scrollView];
self.scrollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self.scrollView addSubview:self.topView];
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.scrollView);
}];
self.tableView.rowHeight = 44;
self.tableView.scrollEnabled = NO;
self.tableView.estimatedSectionFooterHeight = 0;
self.tableView.estimatedSectionHeaderHeight = 0;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
[self.scrollView addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.topView.mas_bottom);
make.left.right.mas_equalTo(self.view);
make.height.mas_equalTo(10*44);
make.bottom.mas_equalTo(self.scrollView);
}];
}
#pragma mark - TableViewDelegate & Datasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 10;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
cell.backgroundColor = kRandomColor;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
- (void)scrollContentAnimateWithOriginY:(CGFloat)originY{
if (self.view.top == originY) {
return;
}
//dampingRatio(阻尼系数)
//velocity (弹性速率)
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:0 animations:^{
self.view.top = originY;
} completion:^(BOOL finished) {
}];
}
- (UIScrollView *)scrollView {
if(_scrollView == nil) {
_scrollView = [[UIScrollView alloc]init];
// _scrollView.backgroundColor = kRandomColor;
// _scrollView.alwaysBounceVertical = YES;
}
return _scrollView;
}
- (XVOrderInfoTopView *)topView {
if(_topView == nil) {
_topView = [[XVOrderInfoTopView alloc]init];
_topView.backgroundColor = [UIColor whiteColor];
}
return _topView;
}
@end
......@@ -298,14 +298,14 @@
- (YYLabel *)remarkLabel {
if (_remarkLabel == nil) {
_remarkLabel = [[YYLabel alloc]init];
_remarkLabel.text = @"这里是备注";
_remarkLabel.font = [UIFont systemFontOfSize:14];
_remarkLabel.backgroundColor = [UIColor whiteColor];
_remarkLabel.textColor = kHexRGB(0x808080);
_remarkLabel.preferredMaxLayoutWidth = SCREEN_WIDTH - 84;
_remarkLabel.textTapAction = ^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
//点击展开
};
}
return _remarkLabel;
......
//
// XVOrderInfoTopView.h
// fastservice
//
// Created by xuning on 2/13/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XVOrderInfoTopView : UIView
@end
NS_ASSUME_NONNULL_END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment