|
@@ -38,7 +38,7 @@
|
|
|
@interface NoteBookVC ()<UITableViewDataSource,UITableViewDelegate,NoteBookShareVCDelegate>
|
|
|
@property (weak, nonatomic) IBOutlet UIButton *rightAddButton;
|
|
|
@property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
|
|
|
-@property (strong, nonatomic) ZFReOrderTableView *reOrderView;
|
|
|
+@property (strong, nonatomic) UITableView *tableView;
|
|
|
@property (weak, nonatomic) IBOutlet UIView *HeadView;
|
|
|
@property (weak, nonatomic) IBOutlet UIButton *operationAllSelectButton;
|
|
|
@property (strong, nonatomic) MyTDGroupView *SearchView;
|
|
@@ -112,19 +112,19 @@
|
|
|
- (void)addRefresh
|
|
|
{
|
|
|
WS(weakSelf);
|
|
|
- self.reOrderView.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
|
+ self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
|
[weakSelf headRefresh];
|
|
|
}];
|
|
|
- // self.reOrderView.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
|
|
+ // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
|
|
// [weakSelf footerRefresh];
|
|
|
// }];
|
|
|
}
|
|
|
- (void)removeRefresh
|
|
|
{
|
|
|
- [self.reOrderView.tableView.mj_header endRefreshing];
|
|
|
- [self.reOrderView.tableView.mj_header removeFromSuperview];
|
|
|
- [self.reOrderView.tableView.mj_footer endRefreshing];
|
|
|
- [self.reOrderView.tableView.mj_footer removeFromSuperview];
|
|
|
+ [self.tableView.mj_header endRefreshing];
|
|
|
+ [self.tableView.mj_header removeFromSuperview];
|
|
|
+ [self.tableView.mj_footer endRefreshing];
|
|
|
+ [self.tableView.mj_footer removeFromSuperview];
|
|
|
self.currentPage = 0;
|
|
|
self.totalPage = 1;
|
|
|
[self.noteBookArray removeAllObjects];
|
|
@@ -143,7 +143,7 @@
|
|
|
self.currentPage += 1;
|
|
|
if (self.totalPage == self.noteBookArray.count) {
|
|
|
self.currentPage --;
|
|
|
- [self.reOrderView.tableView.mj_footer resetNoMoreData];
|
|
|
+ [self.tableView.mj_footer resetNoMoreData];
|
|
|
return ;
|
|
|
}
|
|
|
[self getDataList];
|
|
@@ -159,7 +159,7 @@
|
|
|
MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
weakSelf.totalPage = listModel.Total;
|
|
|
[weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
|
|
|
- weakSelf.reOrderView.dataArray = weakSelf.noteBookArray.mutableCopy;
|
|
|
+// weakSelf.dataArray = weakSelf.noteBookArray.mutableCopy;
|
|
|
|
|
|
for (MyNoteBookSubModel * model in weakSelf.noteBookArray) {
|
|
|
for (MyNoteBookSubModel * fModel in sArray) {
|
|
@@ -169,27 +169,28 @@
|
|
|
}
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [weakSelf.reOrderView.tableView.mj_header endRefreshing];
|
|
|
- [weakSelf.reOrderView.tableView.mj_footer endRefreshing];
|
|
|
- [weakSelf.reOrderView.tableView reloadData];
|
|
|
+ [weakSelf.tableView.mj_header endRefreshing];
|
|
|
+ [weakSelf.tableView.mj_footer endRefreshing];
|
|
|
+ [weakSelf.tableView reloadData];
|
|
|
});
|
|
|
} failure:^(NSError * _Nonnull error) {
|
|
|
|
|
|
}];
|
|
|
}
|
|
|
-- (ZFReOrderTableView *)reOrderView
|
|
|
+- (UITableView *)tableView
|
|
|
{
|
|
|
- if (!_reOrderView) {
|
|
|
- _reOrderView = [[ZFReOrderTableView alloc] initWithFrame:CGRectZero withObjects:self.noteBookArray canReorder:YES];
|
|
|
+ if (!_tableView) {
|
|
|
+ _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
|
+ _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
|
}
|
|
|
- return _reOrderView;
|
|
|
+ return _tableView;
|
|
|
}
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
- self.reOrderView.tableView.delegate = self;
|
|
|
- self.reOrderView.tableView.dataSource = self;
|
|
|
- [self.view addSubview:self.reOrderView];
|
|
|
- [self.reOrderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ self.tableView.delegate = self;
|
|
|
+ self.tableView.dataSource = self;
|
|
|
+ [self.view addSubview:self.tableView];
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(self.view);
|
|
|
make.top.mas_equalTo(self.searchTopView.mas_bottom);
|
|
|
if (@available(iOS 11.0, *)) {
|
|
@@ -201,14 +202,14 @@
|
|
|
}];
|
|
|
|
|
|
WS(weakSelf);
|
|
|
- self.reOrderView.tableView.showsVerticalScrollIndicator= NO;
|
|
|
- self.reOrderView.exchangeDataBlock = ^(NSInteger sourceId,NSInteger toId) {
|
|
|
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(sourceId),@"MiddleIdSecond":@(toId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
|
|
|
- [weakSelf headRefresh];
|
|
|
- } failure:^(NSError * _Nonnull error) {
|
|
|
-
|
|
|
- }];
|
|
|
- };
|
|
|
+ self.tableView.showsVerticalScrollIndicator= NO;
|
|
|
+// self.exchangeDataBlock = ^(NSInteger sourceId,NSInteger toId) {
|
|
|
+// [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(sourceId),@"MiddleIdSecond":@(toId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
|
|
|
+// [weakSelf headRefresh];
|
|
|
+// } failure:^(NSError * _Nonnull error) {
|
|
|
+//
|
|
|
+// }];
|
|
|
+// };
|
|
|
self.fd_prefersNavigationBarHidden = YES;
|
|
|
|
|
|
[self.operationAllSelectButton setTitle:@"全选" forState:UIControlStateNormal];
|
|
@@ -226,7 +227,7 @@
|
|
|
[self.operationAllSelectButton setTitleColor:UIColorHex(#1F87DB) forState:UIControlStateNormal];
|
|
|
self.operationAllSelectButton.hidden = YES;
|
|
|
self.currentPage = 1;
|
|
|
- [self.reOrderView.tableView setAllowsSelectionDuringEditing:YES];
|
|
|
+ [self.tableView setAllowsSelectionDuringEditing:YES];
|
|
|
|
|
|
[self.HeadView addSubview:self.SearchView];
|
|
|
[self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
@@ -464,7 +465,7 @@
|
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|
|
}
|
|
|
else if ([@"批量编辑" isEqualToString:action.title]){
|
|
|
- [weakSelf.reOrderView.tableView setEditing:YES];
|
|
|
+ [weakSelf.tableView setEditing:YES];
|
|
|
[weakSelf changeToOperation:YES];
|
|
|
}else if ([@"共享范围" isEqualToString:action.title]){
|
|
|
MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
|
|
@@ -538,7 +539,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}
|
|
@@ -561,7 +562,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -581,7 +582,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -603,7 +604,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -626,7 +627,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -653,7 +654,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -681,7 +682,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -713,7 +714,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -746,7 +747,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -780,7 +781,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}
|
|
@@ -804,7 +805,7 @@
|
|
|
cell.isShowList = YES;
|
|
|
[cell.noteSelectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
return cell;
|
|
@@ -840,7 +841,7 @@
|
|
|
cell.selectButton.selected = model.IsSelect;
|
|
|
[cell.selectButton setAction:^{
|
|
|
model.IsSelect = !model.IsSelect;
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1410,7 +1411,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}
|
|
@@ -1437,7 +1438,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1461,7 +1462,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1487,7 +1488,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1514,7 +1515,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1545,7 +1546,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1577,7 +1578,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1613,7 +1614,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1650,7 +1651,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}break;
|
|
@@ -1688,7 +1689,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
return cell;
|
|
|
}
|
|
@@ -1716,7 +1717,7 @@
|
|
|
}else{
|
|
|
[weakSelf delectSelelctData:model];
|
|
|
}
|
|
|
- [weakSelf.reOrderView.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}];
|
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
return cell;
|
|
@@ -2017,12 +2018,31 @@
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{
|
|
|
- return YES;
|
|
|
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+
|
|
|
+ return tableView.editing;
|
|
|
}
|
|
|
-- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath
|
|
|
-{
|
|
|
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
|
|
|
+ MyNoteBookSubModel *model = self.noteBookArray[sourceIndexPath.row];
|
|
|
+ MyNoteBookSubModel *toModel = self.noteBookArray[destinationIndexPath.row];
|
|
|
+ WS(weakSelf);
|
|
|
+ if (model.IsTop == toModel.IsTop) {
|
|
|
+ [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(model.Id),@"MiddleIdSecond":@(toModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
|
|
|
+ [weakSelf.noteBookArray removeObject:model];
|
|
|
+ [weakSelf.noteBookArray insertObject:model atIndex:destinationIndexPath.row];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [weakSelf.tableView reloadData];
|
|
|
+ });
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ }else{
|
|
|
+ [weakSelf.noteBookArray removeObject:model];
|
|
|
+ [weakSelf.noteBookArray insertObject:model atIndex:sourceIndexPath.row];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [weakSelf.tableView reloadData];
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- (void)eidtorNoteBook:(MyNoteBookSubModel *)model{
|
|
|
SHOWLOADING
|
|
@@ -2147,14 +2167,6 @@
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
}
|
|
|
|
|
|
-- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{
|
|
|
- return UITableViewCellEditingStyleNone;
|
|
|
-}
|
|
|
-- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{ return NO;}
|
|
|
-- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{ return NO;}
|
|
|
|
|
|
#pragma mark - 检测check 是否可用
|
|
|
- (void)checkMoveButtonEnabled{
|
|
@@ -2189,8 +2201,8 @@
|
|
|
if(operation){
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:@[] forKey:SELECTNOTE];
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
- [self.reOrderView reloadCanReorder:YES];
|
|
|
self.vcTitleLabel.text = @"批量编辑";
|
|
|
+ [self.tableView setEditing:YES];
|
|
|
self.iSViewEditor = YES;
|
|
|
self.rightAddButton.hidden = YES;
|
|
|
self.rightEditBtn.hidden= YES;
|
|
@@ -2202,7 +2214,7 @@
|
|
|
[self.operationAllSelectButton setImage:nil forState:UIControlStateNormal];
|
|
|
self.tabBarController.tabBar.hidden = YES;
|
|
|
self.operationBottomBgView.hidden = NO;
|
|
|
- [self.reOrderView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-self.tabBarController.tabBar.height + 30);
|
|
|
} else {
|
|
@@ -2218,12 +2230,11 @@
|
|
|
}
|
|
|
[self.view layoutIfNeeded];
|
|
|
[self removeRefresh];
|
|
|
- [self.reOrderView.tableView layoutIfNeeded];
|
|
|
+ [self.tableView layoutIfNeeded];
|
|
|
self.threeLIneView.hidden = NO;
|
|
|
self.fd_interactivePopDisabled = YES;
|
|
|
}else{
|
|
|
- [self.reOrderView reloadCanReorder:NO];
|
|
|
- self.reOrderView.tableView.editing = NO;
|
|
|
+ [self.tableView setEditing:NO];
|
|
|
self.rightAddButton.hidden = NO;
|
|
|
[self.rightAddButton setImage:IMG(@"chatmsg_right_add_icon") forState:UIControlStateNormal];
|
|
|
[self.rightAddButton setTitle:nil forState:UIControlStateNormal];
|
|
@@ -2237,7 +2248,7 @@
|
|
|
[self.operationAllSelectButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
|
|
|
self.tabBarController.tabBar.hidden = YES;
|
|
|
[self addRefresh];
|
|
|
- [self.reOrderView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
|
|
|
} else {
|
|
@@ -2250,19 +2261,19 @@
|
|
|
make.top.mas_equalTo(self.searchTopView.mas_top).offset(10);
|
|
|
}];
|
|
|
[self.view layoutIfNeeded];
|
|
|
- [self.reOrderView.tableView layoutIfNeeded];
|
|
|
+ [self.tableView layoutIfNeeded];
|
|
|
self.operationBottomBgView.hidden = YES;
|
|
|
self.threeLIneView.hidden = YES;
|
|
|
self.fd_interactivePopDisabled = NO;
|
|
|
}
|
|
|
- [self.reOrderView.tableView reloadData];
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
#pragma mark 移动 isEdit:当前是否为编辑状态
|
|
|
-(void)userDidMove:(BOOL)move isEdit:(BOOL)isEdit{
|
|
|
//移动
|
|
|
if(move){
|
|
|
- self.reOrderView.tableView.allowsSelectionDuringEditing=YES;
|
|
|
- self.reOrderView.tableView.editing = YES;
|
|
|
+ self.tableView.allowsSelectionDuringEditing=YES;
|
|
|
+ self.tableView.editing = YES;
|
|
|
//默认操作状态为移动状态
|
|
|
self.operationStateEnum = OperationStateEnum2;
|
|
|
self.rightAddButton.hidden = NO;
|
|
@@ -2272,21 +2283,21 @@
|
|
|
//隐藏tabBar - 并将TableView至底端
|
|
|
self.tabBarController.tabBar.hidden = YES;
|
|
|
self.view.height += self.tabBarController.tabBar.height;
|
|
|
- self.reOrderView.tableView.height += self.tabBarController.tabBar.height;
|
|
|
+ self.tableView.height += self.tabBarController.tabBar.height;
|
|
|
[self.view layoutIfNeeded];
|
|
|
- [self.reOrderView.tableView layoutIfNeeded];
|
|
|
+ [self.tableView layoutIfNeeded];
|
|
|
//隐藏operationBottomBgView
|
|
|
self.operationBottomBgView.hidden = YES;
|
|
|
}
|
|
|
else{
|
|
|
- self.reOrderView.tableView.editing = NO;
|
|
|
+ self.tableView.editing = NO;
|
|
|
//隐藏tabBar - 并将TableView至底端有tabBar.height的高
|
|
|
- self.reOrderView.tableView.allowsSelectionDuringEditing=NO;
|
|
|
+ self.tableView.allowsSelectionDuringEditing=NO;
|
|
|
self.tabBarController.tabBar.hidden = YES;
|
|
|
self.view.height -= self.tabBarController.tabBar.height;
|
|
|
- self.reOrderView.tableView.height -= self.tabBarController.tabBar.height;
|
|
|
+ self.tableView.height -= self.tabBarController.tabBar.height;
|
|
|
[self.view layoutIfNeeded];
|
|
|
- [self.reOrderView.tableView layoutIfNeeded];
|
|
|
+ [self.tableView layoutIfNeeded];
|
|
|
//显示operationBottomBgView
|
|
|
self.operationBottomBgView.hidden = NO;
|
|
|
|
|
@@ -2299,7 +2310,7 @@
|
|
|
[self changeToOperation:NO];
|
|
|
}
|
|
|
}
|
|
|
- [self.reOrderView.tableView reloadData];
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
-(UIView *)operationBottomBgView{
|
|
|
if(!_operationBottomBgView){
|
|
@@ -2372,7 +2383,6 @@
|
|
|
MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
weakSelf.totalPage = listModel.Total;
|
|
|
[weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
|
|
|
- weakSelf.reOrderView.dataArray = weakSelf.noteBookArray.mutableCopy;
|
|
|
|
|
|
for (MyNoteBookSubModel * model in weakSelf.noteBookArray) {
|
|
|
for (MyNoteBookSubModel * fModel in sArray) {
|
|
@@ -2382,12 +2392,10 @@
|
|
|
}
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [weakSelf.reOrderView removeFromSuperview];
|
|
|
- weakSelf.reOrderView = nil;
|
|
|
- weakSelf.reOrderView.tableView.delegate = weakSelf;
|
|
|
- weakSelf.reOrderView.tableView.dataSource = weakSelf;
|
|
|
- [weakSelf.view addSubview:self.reOrderView];
|
|
|
- [weakSelf.reOrderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ weakSelf.tableView.delegate = weakSelf;
|
|
|
+ weakSelf.tableView.dataSource = weakSelf;
|
|
|
+ [weakSelf.view addSubview:self.tableView];
|
|
|
+ [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.mas_equalTo(weakSelf.view);
|
|
|
make.top.mas_equalTo(weakSelf.searchTopView.mas_bottom);
|
|
|
if (@available(iOS 11.0, *)) {
|
|
@@ -2396,9 +2404,9 @@
|
|
|
make.bottom.equalTo(weakSelf.view.mas_bottom);
|
|
|
}
|
|
|
}];
|
|
|
- [weakSelf.reOrderView.tableView.mj_header endRefreshing];
|
|
|
- [weakSelf.reOrderView.tableView.mj_footer endRefreshing];
|
|
|
- [weakSelf.reOrderView.tableView reloadData];
|
|
|
+ [weakSelf.tableView.mj_header endRefreshing];
|
|
|
+ [weakSelf.tableView.mj_footer endRefreshing];
|
|
|
+ [weakSelf.tableView reloadData];
|
|
|
});
|
|
|
} failure:^(NSError * _Nonnull error) {
|
|
|
|
|
@@ -2433,7 +2441,7 @@
|
|
|
}
|
|
|
break;
|
|
|
default:{
|
|
|
- [self.reOrderView.tableView setEditing:NO];
|
|
|
+ [self.tableView setEditing:NO];
|
|
|
[super backAction:sender];
|
|
|
} break;
|
|
|
}
|
|
@@ -2450,7 +2458,7 @@
|
|
|
model.IsSelect = !self.isAllselect;
|
|
|
}
|
|
|
[self checkMoveButtonEnabled];
|
|
|
- [self.reOrderView.tableView reloadData];
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
break;
|
|
|
case OperationStateEnum3:
|
|
@@ -2459,7 +2467,7 @@
|
|
|
for (MyNoteBookSubModel *model in self.noteBookArray) {
|
|
|
model.IsSelect = !self.isAllselect;
|
|
|
}
|
|
|
- [self.reOrderView.tableView reloadData];
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -2508,8 +2516,8 @@
|
|
|
CGPoint currentPoint = [recognise locationInView:self.view];
|
|
|
if (recognise.state==UIGestureRecognizerStateBegan) {
|
|
|
_orignY=currentPoint.y;
|
|
|
- _currentPath = [self.reOrderView.tableView indexPathForRowAtPoint:currentPoint];
|
|
|
- _currentCell=[self.reOrderView.tableView cellForRowAtIndexPath:_currentPath];
|
|
|
+ _currentPath = [self.tableView indexPathForRowAtPoint:currentPoint];
|
|
|
+ _currentCell=[self.tableView cellForRowAtIndexPath:_currentPath];
|
|
|
_currentCell.hidden=YES;
|
|
|
_cellImage=[UIImageView new];
|
|
|
_cellImage.image=[self getImageWithCell:_currentCell];
|
|
@@ -2524,7 +2532,7 @@
|
|
|
if (currentPoint.y-_orignY>30) {
|
|
|
NSIndexPath *newIndexPath=[NSIndexPath indexPathForRow:_currentPath.row+1 inSection:0];
|
|
|
if(newIndexPath.row<self.noteBookArray.count){
|
|
|
- [self.reOrderView.tableView moveRowAtIndexPath:_currentPath toIndexPath:newIndexPath];
|
|
|
+ [self.tableView moveRowAtIndexPath:_currentPath toIndexPath:newIndexPath];
|
|
|
_currentPath=newIndexPath;
|
|
|
_orignY+=60;
|
|
|
}
|
|
@@ -2534,7 +2542,7 @@
|
|
|
}else{
|
|
|
if (_orignY-currentPoint.y>30) {
|
|
|
NSIndexPath *newIndexPath=[NSIndexPath indexPathForRow:_currentPath.row-1 inSection:0];
|
|
|
- [self.reOrderView.tableView moveRowAtIndexPath:_currentPath toIndexPath:newIndexPath];
|
|
|
+ [self.tableView moveRowAtIndexPath:_currentPath toIndexPath:newIndexPath];
|
|
|
_currentPath=newIndexPath;
|
|
|
_orignY-=60;
|
|
|
}
|
|
@@ -2591,7 +2599,7 @@
|
|
|
-- mdoel.PraiseCount;
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [weakSelf.reOrderView.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
|
|
|
});
|
|
|
} failure:^(NSError * _Nonnull error) {
|
|
|
SHOWERROR([ZYCTool handerResultData:error]);
|
|
@@ -2954,7 +2962,7 @@
|
|
|
}
|
|
|
- (void)makeSwipeButton
|
|
|
{
|
|
|
- for (UIView *subview in self.reOrderView.tableView.subviews)
|
|
|
+ for (UIView *subview in self.tableView.subviews)
|
|
|
{
|
|
|
if ([subview isKindOfClass:NSClassFromString(@"UISwipeActionPullView")] )
|
|
|
{
|