| | |
| | | 创建操作视图(全选,删除) |
| | | */ |
| | | -(void)CreateOperatingView{ |
| | | allSelAndDelView = [[UIView alloc]initWithFrame:CGRectMake(0, KScreenH-40, KScreenW, 40)]; |
| | | CGFloat height = 40; |
| | | if (KIsiPhoneX) { |
| | | height = 60; |
| | | } |
| | | allSelAndDelView = [[UIView alloc]initWithFrame:CGRectMake(0, KScreenH-height, KScreenW, 40)]; |
| | | allSelAndDelView.hidden = YES; |
| | | allSelAndDelView.backgroundColor = [UIColor whiteColor]; |
| | | |
| | |
| | | -(void)allSelectOrCancelClick{ |
| | | if ([allSelectBut.titleLabel.text isEqualToString:@"全选"]){ |
| | | [allSelectBut setTitle:@"取消全选" forState:UIControlStateNormal]; |
| | | [deleteBut setTitle:[NSString stringWithFormat:@"删除(%ld)",(unsigned long)_editDataAry.count] forState:UIControlStateNormal]; |
| | | for (int i = 0 ; i <historyListDataArray.count; ++i){ |
| | | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0]; |
| | | [mytableview selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; |
| | | [_editDataAry addObject:[historyListDataArray objectAtIndex:i]]; |
| | | } |
| | | [deleteBut setTitle:[NSString stringWithFormat:@"删除(%ld)",(unsigned long)_editDataAry.count] forState:UIControlStateNormal]; |
| | | |
| | | }else{ |
| | | [allSelectBut setTitle:@"全选" forState:UIControlStateNormal]; |
| | | [deleteBut setTitle:[NSString stringWithFormat:@"删除"] forState:UIControlStateNormal]; |
| | |
| | | for (int i = 0 ; i < _editDataAry.count ; ++i){ |
| | | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0]; |
| | | [mytableview deselectRowAtIndexPath:indexPath animated:NO]; |
| | | [_editDataAry removeAllObjects]; |
| | | } |
| | | [_editDataAry removeAllObjects]; |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | * 删除 |
| | | */ |
| | | -(void)deleteSelectDataClick{ |
| | | if (_editDataAry.count == 0) { |
| | | [self autoDisappearAlertTime:0.5 msg:@"请选择要删除的记录"]; |
| | | return; |
| | | } |
| | | [deleBtn setSelected:NO]; |
| | | [deleBtn setImage:[[UIImage imageNamed:@"删除"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; |
| | | allSelAndDelView.hidden = YES; |
| | | |
| | | [historyListDataArray removeObjectsInArray:_editDataAry]; |
| | | |
| | | [_editDataAry removeAllObjects]; |
| | | [deleteBut setTitle:[NSString stringWithFormat:@"删除"] forState:UIControlStateNormal]; |
| | | |
| | | //写入 HISTORYFILE |
| | | if (historyListDataArray.count){ |
| | | [historyListDataArray writeToFile:HISTORYFILE atomically:YES]; |
| | |
| | | * 右上删除按钮 |
| | | */ |
| | | -(void)deletebutton:(id)sender{ |
| | | [deleteBut setTitle:[NSString stringWithFormat:@"删除"] forState:UIControlStateNormal]; |
| | | |
| | | if (mytableview.editing) { |
| | | [mytableview setEditing:NO]; |
| | | [deleBtn setSelected:NO]; |