Commit 11b26e92 authored by admin's avatar admin

完善在线抽查权限

parent e0627ecd
...@@ -321,12 +321,18 @@ ...@@ -321,12 +321,18 @@
cell.photoButton2.tag = 22011; cell.photoButton2.tag = 22011;
[cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside]; [cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
// UILongPressGestureRecognizer *longGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longClick:)];
// [cell.photoButton1 addGestureRecognizer:longGR];
// cell.contentView.backgroundColor = [UIColor orangeColor];
return cell; return cell;
} else { } else {
InspectAddCell *cell=[tableView dequeueReusableCellWithIdentifier:kOnLineInspectAddCell]; InspectAddCell *cell=[tableView dequeueReusableCellWithIdentifier:kOnLineInspectAddCell];
if (!cell) { if (!cell) {
cell = [[InspectAddCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kOnLineInspectAddCell]; cell = [[InspectAddCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kOnLineInspectAddCell];
} }
cell.photoButton.tag = 22001; cell.photoButton.tag = 22001;
[cell.photoButton addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside]; [cell.photoButton addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
...@@ -347,6 +353,8 @@ ...@@ -347,6 +353,8 @@
cell.photoButton1.tag = 1118 + (indexPath.row ) * 2; cell.photoButton1.tag = 1118 + (indexPath.row ) * 2;
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal]; [cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
NSString *imageName1 = _imageNameArray[(indexPath.row) * 2 + 1]; NSString *imageName1 = _imageNameArray[(indexPath.row) * 2 + 1];
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1]; NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
...@@ -355,6 +363,13 @@ ...@@ -355,6 +363,13 @@
[cell.photoButton2 addTarget:self action:@selector(showLookOnLinePic:) forControlEvents:UIControlEventTouchUpInside]; [cell.photoButton2 addTarget:self action:@selector(showLookOnLinePic:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton2.tag = 1118 + (indexPath.row ) * 2 + 1; cell.photoButton2.tag = 1118 + (indexPath.row ) * 2 + 1;
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal]; [cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
// UILongPressGestureRecognizer *longGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longClick:)];
//
// [cell.photoButton1 addGestureRecognizer:longGR];
// [cell.photoButton2 addGestureRecognizer:longGR];
return cell; return cell;
} }
...@@ -362,6 +377,39 @@ ...@@ -362,6 +377,39 @@
} }
- (void)longClick:(UIGestureRecognizer *)longGR
{
if (longGR.state == UIGestureRecognizerStateBegan) {
// 获取到点击的显示图片的按钮
UIButton *showButton = (UIButton *)longGR.view;
// 创建长按删除的按钮
UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
deleteButton.tag = 5521 + (showButton.tag - 1118);
deleteButton.backgroundColor = [UIColor redColor];
deleteButton.bounds = CGRectMake(0, 0, 20, 20);
[deleteButton addTarget:self action:@selector(deletePicture:) forControlEvents:UIControlEventTouchUpInside];
deleteButton.frame = CGRectMake(showButton.frame.size.width - deleteButton.frame.size.width, 0, deleteButton.frame.size.width, deleteButton.frame.size.height);
[showButton addSubview:deleteButton];
}
}
// 删除图片
- (void)deletePicture:(UIButton *)button
{
// 从存放所有Image的数组里移除当前点击的Image
[self.imageNameArray removeObjectAtIndex:(button.tag - 5521)];
if ((_imageNameArray.count + 1) % 2 == 0) {
_rowNumber--;
[self.tableView reloadData];
} else {
[self.tableView reloadData];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{ {
return CGFLOAT_MIN; return CGFLOAT_MIN;
......
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