Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP IOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
红星美凯龙管理在线APP IOS
Commits
54200797
Commit
54200797
authored
9 years ago
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
长按删除照片
parent
e639546a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
19 deletions
+171
-19
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
LookOnLineDetailViewController.m
...ineDetail/ViewController/LookOnLineDetailViewController.m
+42
-16
AddQuestionViewController.m
...on/AddQuestion/ViewController/AddQuestionViewController.m
+68
-1
InspectNotUploadViewController.m
...ectDetail/ViewController/InspectNotUploadViewController.m
+61
-2
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
54200797
No preview for this file type
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/OnLine/LookOnLineDetail/ViewController/LookOnLineDetailViewController.m
View file @
54200797
...
...
@@ -33,6 +33,9 @@
@property
(
nonatomic
,
assign
)
int
rowNumber
;
@property
(
nonatomic
,
strong
)
NSLayoutConstraint
*
tableBottom
;
@property
(
nonatomic
,
strong
)
NSLayoutConstraint
*
tableTop
;
@property
(
nonatomic
,
strong
)
UIButton
*
deleteButton
;
@end
@implementation
LookOnLineDetailViewController
...
...
@@ -160,6 +163,10 @@
lager
.
index
=
sender
.
tag
-
1118
;
lager
.
pictureSaveMode
=
PictureLocalMode
;
lager
.
allImageArray
=
_imageNameArray
;
[
self
removeDeleteButton
];
[
self
.
navigationController
pushViewController
:
lager
animated
:
YES
];
}
...
...
@@ -322,9 +329,9 @@
[
cell
.
photoButton2
addTarget
:
self
action
:
@selector
(
createImagePicker
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
// UILongPressGestureRecognizer *longGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longClick:)];
// [cell.photoButton1 addGestureRecognizer:longGR
];
// cell.contentView.backgroundColor = [UIColor orangeColor
];
// 添加长按手势
UILongPressGestureRecognizer
*
longGR
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)
];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR
];
return
cell
;
}
else
{
...
...
@@ -365,11 +372,12 @@
[
cell
.
photoButton2
setImage
:
image11
forState
:
UIControlStateNormal
];
// 添加长按手势
UILongPressGestureRecognizer
*
longGR1
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR1
];
// UILongPressGestureRecognizer *longGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longClick:)];
//
// [cell.photoButton1 addGestureRecognizer:longGR];
// [cell.photoButton2 addGestureRecognizer:longGR];
UILongPressGestureRecognizer
*
longGR2
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton2
addGestureRecognizer
:
longGR2
];
return
cell
;
}
...
...
@@ -377,27 +385,34 @@
}
-
(
void
)
longClick
:
(
UIGestureRecognizer
*
)
longGR
{
if
(
longGR
.
state
==
UIGestureRecognizerStateBegan
)
{
// 获取到点击的显示图片的按钮
UIButton
*
showButton
=
(
UIButton
*
)
longGR
.
view
;
// 创建长按删除的按钮
-
(
void
)
longClick
:
(
UIGestureRecognizer
*
)
longGR
{
// 获取到点击的显示图片的按钮
UIButton
*
showButton
=
(
UIButton
*
)
longGR
.
view
;
NSLog
(
@"我长按了第%ld张图片"
,
(
showButton
.
tag
-
1118
));
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
if
(
!
_deleteButton
)
{
UIButton
*
deleteButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
deleteButton
.
tag
=
5521
+
(
showButton
.
tag
-
1118
);
deleteButton
.
backgroundColor
=
[
UIColor
redColor
];
[
deleteButton
setImage
:[
UIImage
imageNamed
:
@"close"
]
forState
:
UIControlStateNormal
];
deleteButton
.
backgroundColor
=
[
UIColor
whiteColor
];
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
];
_deleteButton
=
deleteButton
;
}
}
// 删除图片
-
(
void
)
deletePicture
:
(
UIButton
*
)
button
{
NSLog
(
@"从imageName中删除了第%ld张图片"
,(
button
.
tag
-
5521
));
// 从存放所有Image的数组里移除当前点击的Image
[
self
.
imageNameArray
removeObjectAtIndex
:(
button
.
tag
-
5521
)];
...
...
@@ -407,7 +422,18 @@
}
else
{
[
self
.
tableView
reloadData
];
}
[
button
removeFromSuperview
];
button
=
nil
;
[
self
removeDeleteButton
];
}
-
(
void
)
removeDeleteButton
{
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForHeaderInSection
:
(
NSInteger
)
section
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m
View file @
54200797
...
...
@@ -58,6 +58,9 @@
@property
(
nonatomic
)
BOOL
isComplete
;
@property
(
nonatomic
)
BOOL
isLoad
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
groupUuidDict
;
@property
(
nonatomic
,
strong
)
UIButton
*
deleteButton
;
@end
@implementation
AddQuestionViewController
...
...
@@ -193,6 +196,7 @@
lager
.
index
=
sender
.
tag
-
kPhotoTag
;
lager
.
pictureSaveMode
=
PictureLocalMode
;
lager
.
allImageArray
=
_imageNameArray
;
[
self
removeDeleteButton
];
[
self
.
navigationController
pushViewController
:
lager
animated
:
YES
];
// CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
...
...
@@ -216,7 +220,7 @@
_selectActionSheet
.
delegate
=
self
;
_selectActionSheet
.
tag
=
999283
;
[
_selectActionSheet
showInView
:
self
.
view
];
[
self
removeDeleteButton
];
if
(
sender
.
tag
==
2201
)
{
_rowNumber
++
;
...
...
@@ -238,6 +242,57 @@
[
imageData
writeToFile
:
fullPath
atomically
:
NO
];
}
-
(
void
)
longClick
:
(
UIGestureRecognizer
*
)
longGR
{
// 获取到点击的显示图片的按钮
UIButton
*
showButton
=
(
UIButton
*
)
longGR
.
view
;
NSLog
(
@"我长按了第%ld张图片"
,
(
showButton
.
tag
-
kPhotoTag
));
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
if
(
!
_deleteButton
)
{
UIButton
*
deleteButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
deleteButton
.
tag
=
5521
+
(
showButton
.
tag
-
kPhotoTag
);
[
deleteButton
setImage
:[
UIImage
imageNamed
:
@"close"
]
forState
:
UIControlStateNormal
];
deleteButton
.
backgroundColor
=
[
UIColor
whiteColor
];
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
];
_deleteButton
=
deleteButton
;
}
}
// 删除图片
-
(
void
)
deletePicture
:
(
UIButton
*
)
button
{
NSLog
(
@"从imageName中删除了第%ld张图片"
,(
button
.
tag
-
5521
));
// 从存放所有Image的数组里移除当前点击的Image
[
self
.
imageNameArray
removeObjectAtIndex
:(
button
.
tag
-
5521
)];
if
((
_imageNameArray
.
count
+
1
)
%
2
==
0
)
{
_rowNumber
--
;
[
self
.
tableView
reloadData
];
}
else
{
[
self
.
tableView
reloadData
];
}
[
button
removeFromSuperview
];
button
=
nil
;
[
self
removeDeleteButton
];
}
-
(
void
)
removeDeleteButton
{
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
}
#pragma mark - UIImagePickerController 代理方法
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
...
...
@@ -520,6 +575,11 @@
cell
.
photoButton2
.
tag
=
2201
;
[
cell
.
photoButton2
addTarget
:
self
action
:
@selector
(
createImagePicker
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
// 添加长按手势
UILongPressGestureRecognizer
*
longGR1
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR1
];
return
cell
;
}
else
{
...
...
@@ -561,6 +621,13 @@
[
cell
.
photoButton2
addTarget
:
self
action
:
@selector
(
showPicture
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
photoButton2
.
tag
=
kPhotoTag
+
(
indexPath
.
row
-
3
)
*
2
+
1
;
// 添加长按手势
UILongPressGestureRecognizer
*
longGR1
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR1
];
UILongPressGestureRecognizer
*
longGR2
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton2
addGestureRecognizer
:
longGR2
];
return
cell
;
}
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectNotUploadViewController.m
View file @
54200797
...
...
@@ -36,6 +36,7 @@
@property
(
nonatomic
,
strong
)
NSLayoutConstraint
*
tableBottom
;
@property
(
nonatomic
,
strong
)
NSLayoutConstraint
*
tableTop
;
@property
(
nonatomic
,
assign
)
int
rowNumber
;
@property
(
nonatomic
,
strong
)
UIButton
*
deleteButton
;
@end
...
...
@@ -101,6 +102,7 @@
largeVC
.
index
=
sender
.
tag
-
kPhotoTag
;
largeVC
.
allImageArray
=
_imageNameArray
;
largeVC
.
pictureSaveMode
=
PictureLocalMode
;
[
self
removeDeleteButton
];
[
self
.
navigationController
pushViewController
:
largeVC
animated
:
YES
];
...
...
@@ -118,7 +120,7 @@
if
(
sender
.
tag
==
2201
)
{
_rowNumber
++
;
}
[
self
removeDeleteButton
];
if
(
!
[
UIImagePickerController
isSourceTypeAvailable
:
UIImagePickerControllerSourceTypeCamera
])
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
nil
message
:
@"找不到相机"
delegate
:
nil
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
...
...
@@ -130,6 +132,7 @@
picker
.
videoQuality
=
UIImagePickerControllerQualityTypeLow
;
[
self
presentViewController
:
picker
animated
:
YES
completion
:
nil
];
}
}
...
...
@@ -214,6 +217,9 @@
cell
.
photoButton2
.
tag
=
2201
;
[
cell
.
photoButton2
addTarget
:
self
action
:
@selector
(
createImagePicker
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
UILongPressGestureRecognizer
*
longGR1
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR1
];
return
cell
;
}
else
{
...
...
@@ -255,12 +261,65 @@
[
cell
.
photoButton2
addTarget
:
self
action
:
@selector
(
showPicture
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
cell
.
photoButton2
.
tag
=
kPhotoTag
+
(
indexPath
.
row
-
1
)
*
2
+
1
;
// 添加长按手势
UILongPressGestureRecognizer
*
longGR1
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton1
addGestureRecognizer
:
longGR1
];
UILongPressGestureRecognizer
*
longGR2
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
longClick
:
)];
[
cell
.
photoButton2
addGestureRecognizer
:
longGR2
];
return
cell
;
}
}
-
(
void
)
longClick
:
(
UIGestureRecognizer
*
)
longGR
{
// 获取到点击的显示图片的按钮
UIButton
*
showButton
=
(
UIButton
*
)
longGR
.
view
;
NSLog
(
@"我长按了第%ld张图片"
,
(
showButton
.
tag
-
kPhotoTag
));
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
if
(
!
_deleteButton
)
{
UIButton
*
deleteButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
deleteButton
.
tag
=
5521
+
(
showButton
.
tag
-
kPhotoTag
);
[
deleteButton
setImage
:[
UIImage
imageNamed
:
@"close"
]
forState
:
UIControlStateNormal
];
deleteButton
.
backgroundColor
=
[
UIColor
whiteColor
];
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
];
_deleteButton
=
deleteButton
;
}
}
// 删除图片
-
(
void
)
deletePicture
:
(
UIButton
*
)
button
{
NSLog
(
@"从imageName中删除了第%ld张图片"
,(
button
.
tag
-
5521
));
// 从存放所有Image的数组里移除当前点击的Image
[
self
.
imageNameArray
removeObjectAtIndex
:(
button
.
tag
-
5521
)];
if
((
_imageNameArray
.
count
+
1
)
%
2
==
0
)
{
_rowNumber
--
;
[
self
.
tableView
reloadData
];
}
else
{
[
self
.
tableView
reloadData
];
}
[
button
removeFromSuperview
];
button
=
nil
;
[
self
removeDeleteButton
];
}
-
(
void
)
removeDeleteButton
{
if
(
_deleteButton
)
{
[
_deleteButton
removeFromSuperview
];
_deleteButton
=
nil
;
}
}
// section高度
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForHeaderInSection
:
(
NSInteger
)
section
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment