Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
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
张杰
xffruit
Commits
8c03c5a1
Commit
8c03c5a1
authored
Mar 07, 2016
by
管鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
『行情调研』详情图片展示
parent
70eb0a29
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
50 deletions
+83
-50
NSDate+FormatterAdditions.h
XFFruit/General/Categories/NSDate+FormatterAdditions.h
+2
-0
NSDate+FormatterAdditions.m
XFFruit/General/Categories/NSDate+FormatterAdditions.m
+6
-0
UIImage+Helper.m
XFFruit/General/Categories/UIImage+Helper.m
+3
-1
HGPhWViewController.m
...ers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.m
+2
-2
WriteFeedbackViewController.m
...it/ViewControllers/FeedBack/WriteFeedbackViewController.m
+10
-10
ResultView.m
XFFruit/ViewControllers/Survey/Views/ResultView.m
+31
-31
SurveyResultCell.m
XFFruit/ViewControllers/Survey/Views/SurveyResultCell.m
+4
-0
ResultDetailViewController.m
...ntrollers/Survey/controllers/ResultDetailViewController.m
+25
-6
No files found.
XFFruit/General/Categories/NSDate+FormatterAdditions.h
View file @
8c03c5a1
...
...
@@ -57,6 +57,8 @@
-
(
NSDate
*
)
endOfTheDay
;
+
(
NSString
*
)
randomImageName
;
///--------------------
/// @name Time In Words
///--------------------
...
...
XFFruit/General/Categories/NSDate+FormatterAdditions.m
View file @
8c03c5a1
...
...
@@ -310,6 +310,12 @@
return
[
calendar
dateFromComponents
:
comp
];
}
+
(
NSString
*
)
randomImageName
{
NSString
*
randomStrImgName
=
[
NSString
stringWithFormat
:
@"%@-%d.jpg"
,
[[
self
class
]
curTimeStamp
],
(
arc4random
()
%
100000
)
+
100000
];
return
randomStrImgName
;
}
+
(
NSString
*
)
timeInWordsFromTimeInterval
:
(
NSTimeInterval
)
intervalInSeconds
includingSeconds
:
(
BOOL
)
includeSeconds
{
NSTimeInterval
intervalInMinutes
=
round
(
intervalInSeconds
/
60
.
0
f
);
...
...
XFFruit/General/Categories/UIImage+Helper.m
View file @
8c03c5a1
...
...
@@ -188,7 +188,7 @@ typedef enum {
//压缩到100kb以内
CGFloat
compression
=
0
.
5
f
;
CGFloat
maxCompression
=
0
.
1
f
;
NSUInteger
maxlength
=
kb
*
10
0
;
NSUInteger
maxlength
=
kb
*
10
24
;
NSData
*
imgData
=
UIImageJPEGRepresentation
(
self
,
compression
);
CLog
(
@"处理之前的大小--->%lukB"
,(
unsigned
long
)
imgData
.
length
/
1024
);
while
([
imgData
length
]
>
maxlength
&&
compression
>
maxCompression
)
{
...
...
@@ -197,6 +197,8 @@ typedef enum {
}
CLog
(
@"处理之后的大小--->%lukB"
,(
unsigned
long
)
imgData
.
length
/
1024
);
return
imgData
;
}
...
...
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.m
View file @
8c03c5a1
...
...
@@ -239,7 +239,7 @@ static HGPhWViewController *_instance = nil;
// [self.allImgsMuArr addObject:imgData];
[[
JavenImages
shareInstance
]
insertAImage
:[
img
scaledToWidth
:
6
00
]];
[[
JavenImages
shareInstance
]
insertAImage
:[
img
scaledToWidth
:
2
00
]];
[
self
scrollViewContentHeight
];
[
picker
DismissModalViewControllerAnimated
:
YES
];
}
...
...
@@ -268,7 +268,7 @@ static HGPhWViewController *_instance = nil;
CGImageRef
ref
=
[[
asset
defaultRepresentation
]
fullResolutionImage
];
UIImage
*
img
=
[[
UIImage
alloc
]
initWithCGImage
:
ref
];
[
self
.
imgesMuArr
addObject
:
[
img
scaledToWidth
:
6
00
]];
//[UIImage imageNamed:@"AttachCamera"]
[
self
.
imgesMuArr
addObject
:
[
img
scaledToWidth
:
2
00
]];
//[UIImage imageNamed:@"AttachCamera"]
}
[[
JavenImages
shareInstance
]
insertImages
:
_imgesMuArr
];
...
...
XFFruit/ViewControllers/FeedBack/WriteFeedbackViewController.m
View file @
8c03c5a1
...
...
@@ -98,17 +98,17 @@ typedef NS_ENUM(NSUInteger, feedbackCellInfo){
success
:
succ
failure
:
fail
];
#ifdef DEBUG
self
.
surveyResult
=
[[
SurveyResult
alloc
]
init
];
self
.
surveyResult
.
unit
=
@"南汇8424西瓜调研情况"
;
self
.
surveyResult
.
place
=
@"
150605000001
"
;
self
.
surveyResult
.
place
=
@"
上海徐汇
"
;
self
.
surveyResult
.
price
=
@"26"
;
self
.
surveyResult
.
capacity
=
@"2
2222222222
"
;
self
.
surveyResult
.
quality
=
@"
费卡接口
"
;
self
.
surveyResult
.
capacity
=
@"2
50
"
;
self
.
surveyResult
.
quality
=
@"
优质
"
;
self
.
surveyResult
.
userName
=
@"张三"
;
self
.
surveyResult
.
feedbackTime
=
@"2015-04-05 12:04:06"
;
self
.
surveyResult
.
reMark
=
@"今天工作人员效率很高"
;
#endif
}
...
...
@@ -338,7 +338,7 @@ typedef NS_ENUM(NSUInteger, feedbackCellInfo){
// NSData *imgData = UIImagePNGRepresentation(img);
// [self savePhotoToDB:imgData];
[[
JavenImages
shareInstance
]
insertAImage
:[
img
scaledToWidth
:
6
00
]];
[[
JavenImages
shareInstance
]
insertAImage
:[
img
scaledToWidth
:
2
00
]];
[
self
pushToHGphVC
];
}
...
...
@@ -375,7 +375,7 @@ typedef NS_ENUM(NSUInteger, feedbackCellInfo){
CGImageRef
ref
=
[[
asset
defaultRepresentation
]
fullResolutionImage
];
UIImage
*
img
=
[[
UIImage
alloc
]
initWithCGImage
:
ref
];
[
self
.
imgesMuArr
addObject
:
[
img
scaledToWidth
:
6
00
]];
//[UIImage imageNamed:@"AttachCamera"]
[
self
.
imgesMuArr
addObject
:
[
img
scaledToWidth
:
2
00
]];
//[UIImage imageNamed:@"AttachCamera"]
}
[[
JavenImages
shareInstance
]
insertImages
:
self
.
imgesMuArr
];
...
...
@@ -455,9 +455,9 @@ typedef NS_ENUM(NSUInteger, feedbackCellInfo){
}
else
{
for
(
int
count
=
0
;
count
<
[
JavenImages
shareInstance
].
imageArr
.
count
;
count
++
)
{
UIImage
*
image
=
[
JavenImages
shareInstance
].
imageArr
[
count
];
NSData
*
data
=
[
image
scaledToSpaceMaxSize
:
10
0
];
NSString
*
enCodeImageStr
=
[
data
base64EncodedString
WithOptions
:
NSDataBase64Encoding64CharacterLineLength
];
NSMutableDictionary
*
phontoMuDict
=
[
NSMutableDictionary
dictionaryWithObjects
:@[
@""
,
enCodeImageStr
]
forKeys
:@[
@"fileName"
,
@"content"
]];
NSData
*
data
=
[
image
scaledToSpaceMaxSize
:
2
0
];
NSString
*
enCodeImageStr
=
[
data
base64EncodedString
];
NSMutableDictionary
*
phontoMuDict
=
[
NSMutableDictionary
dictionaryWithObjects
:@[
[
NSDate
randomImageName
]
,
enCodeImageStr
]
forKeys
:@[
@"fileName"
,
@"content"
]];
[
attachArr
addObject
:
phontoMuDict
];
}
...
...
XFFruit/ViewControllers/Survey/Views/ResultView.m
View file @
8c03c5a1
...
...
@@ -26,7 +26,7 @@
-
(
id
)
initWithFrame
:(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
_imagesArray
=
[
NSMutableArray
new
];
// _images
= [NSMutableArray new];
_scrollView
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TPSamleVT_Top_Height
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
-
TPSamleVT_Top_Height
*
2
)];
_scrollView
.
delegate
=
self
;
...
...
@@ -39,9 +39,9 @@
}
-
(
void
)
setScrollView
{
[
self
setImagesArray
];
_scrollView
.
contentSize
=
CGSizeMake
(
_scrollView
.
frame
.
size
.
width
*
_images
Array
.
count
,
_scrollView
.
frame
.
size
.
height
);
_scrollView
.
contentOffset
=
CGPointMake
(
_scrollView
.
frame
.
size
.
width
*
(
self
.
index
+
1
),
0
);
//
[self setImagesArray];
_scrollView
.
contentSize
=
CGSizeMake
(
_scrollView
.
frame
.
size
.
width
*
_images
.
count
,
_scrollView
.
frame
.
size
.
height
);
//
_scrollView.contentOffset = CGPointMake(_scrollView.frame.size.width*(self.index+1), 0);
_scrollView
.
alpha
=
0
;
[
UIView
animateWithDuration
:
1
animations
:
^
{
_scrollView
.
alpha
=
1
;
...
...
@@ -53,8 +53,8 @@
//创建滚动视图上的图片按钮
-
(
void
)
createImageButton
{
for
(
NSInteger
i
=
0
;
i
<
_images
Array
.
count
;
i
++
)
{
SingleScrollView
*
customView
=
[[
SingleScrollView
alloc
]
initWithFrame
:
CGRectMake
(
_scrollView
.
frame
.
size
.
width
*
(
i
),
0
,
self
.
frame
.
size
.
width
,
_scrollView
.
frame
.
size
.
height
)
image
:
_images
Array
[
i
]];
for
(
NSInteger
i
=
0
;
i
<
_images
.
count
;
i
++
)
{
SingleScrollView
*
customView
=
[[
SingleScrollView
alloc
]
initWithFrame
:
CGRectMake
(
_scrollView
.
frame
.
size
.
width
*
(
i
),
0
,
self
.
frame
.
size
.
width
,
_scrollView
.
frame
.
size
.
height
)
image
:
_images
[
i
]];
[
customView
addSingleClickTarget
:
self
action
:
@selector
(
imageViewHide
)];
customView
.
delegate
=
self
;
[
_scrollView
addSubview
:
customView
];
...
...
@@ -62,34 +62,34 @@
}
//为图片数组赋值
-
(
void
)
setImagesArray
{
[
_imagesArray
removeAllObjects
];
if
(
self
.
images
.
count
>
0
)
{
Attachment
*
att
=
[
self
.
images
lastObject
];
[
_imagesArray
addObject
:
att
.
content
];
for
(
Attachment
*
typeBo
in
self
.
images
)
{
[
_imagesArray
addObject
:
typeBo
.
content
];
}
Attachment
*
endTypeBo
=
self
.
images
[
0
];
[
_imagesArray
addObject
:
endTypeBo
.
content
];
}
else
{
[
_imagesArray
addObject
:
@"HomeDisplayImage"
];
[
_imagesArray
addObject
:
@"HomeDisplayImage"
];
[
_imagesArray
addObject
:
@"HomeDisplayImage"
];
}
}
//
- (void)setImagesArray{
//
[_imagesArray removeAllObjects];
//
if (self.images.count >0) {
//
Attachment *att =[self.images lastObject];
//
[_imagesArray addObject:att.content];
//
for (Attachment *typeBo in self.images) {
//
[_imagesArray addObject:typeBo.content];
//
}
//
Attachment *endTypeBo = self.images[0];
//
[_imagesArray addObject:endTypeBo.content];
//
}else{
//
[_imagesArray addObject:@"HomeDisplayImage"];
//
[_imagesArray addObject:@"HomeDisplayImage"];
//
[_imagesArray addObject:@"HomeDisplayImage"];
//
}
//
//
}
#pragma mark - scrollView协议的方法
-
(
void
)
scrollViewDidEndDecelerating
:
(
UIScrollView
*
)
scrollView
{
float
offsetX
=
_scrollView
.
contentOffset
.
x
;
if
(
offsetX
/
_scrollView
.
frame
.
size
.
width
==
0
)
{
_scrollView
.
contentOffset
=
CGPointMake
(
scrollView
.
frame
.
size
.
width
*
(
_imagesArray
.
count
-
2
),
0
);
}
else
if
(
offsetX
/
scrollView
.
frame
.
size
.
width
==
_imagesArray
.
count
-
1
)
{
_scrollView
.
contentOffset
=
CGPointMake
(
scrollView
.
frame
.
size
.
width
*
1
,
0
);
}
//
float offsetX=_scrollView.contentOffset.x;
//
if (offsetX/_scrollView.frame.size.width==0) {
// _scrollView.contentOffset=CGPointMake(scrollView.frame.size.width*(_images
.count-2), 0);
//
// }else if (offsetX/scrollView.frame.size.width==_images
.count-1) {
//
_scrollView.contentOffset=CGPointMake(scrollView.frame.size.width*1, 0);
//
//
}
if
(
!
[
scrollView
isKindOfClass
:[
SingleScrollView
class
]])
{
for
(
SingleScrollView
*
sv
in
scrollView
.
subviews
)
{
//如果 自定义的滚动视图 有放大 那么在滚动下方的滚动视图减速停止的时候 还原自定义滚动视图的大小
...
...
XFFruit/ViewControllers/Survey/Views/SurveyResultCell.m
View file @
8c03c5a1
...
...
@@ -7,6 +7,7 @@
//
#import "SurveyResultCell.h"
#import "UIButton+WebCache.h"
#define TopMargin 10
#define TitleHeight 20
...
...
@@ -69,7 +70,10 @@
}
-
(
void
)
setSurveyResult
:
(
SurveyResult
*
)
surveyResult
{
[
self
.
imageBtn
setBackgroundImage
:[
UIImage
imageNamed
:
@"no_image_default"
]
forState
:
UIControlStateNormal
];
[
self
.
imageBtn
sd_setImageWithURL
:[
surveyResult
.
attachmnets
count
]
>
0
?
surveyResult
.
attachmnets
[
0
]
:
nil
forState
:
UIControlStateNormal
];
self
.
imageBtn
.
imageView
.
contentMode
=
UIViewContentModeScaleAspectFill
;
self
.
dateLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
surveyResult
.
feedbackTime
];
self
.
userNameLabel
.
text
=
[
NSString
stringWithFormat
:
@"反馈人:%@"
,
surveyResult
.
userName
];
self
.
placeLabel
.
text
=
[
NSString
stringWithFormat
:
@"产地:%@"
,
surveyResult
.
place
];
...
...
XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m
View file @
8c03c5a1
...
...
@@ -62,6 +62,16 @@
SurveyResult
*
surveyResult
=
[[
SurveyResult
alloc
]
init
];
[
surveyResult
setValuesForKeysWithDictionary
:
resultDict
];
surveyResult
.
attachmnets
=
surveyDict
[
@"attachments"
];
NSMutableArray
*
imageArr
=
[
NSMutableArray
array
];
for
(
NSString
*
str
in
surveyResult
.
attachmnets
)
{
NSRange
range
=
[
HTTP_REST_API_BASE_URL
rangeOfString
:
@"cruiser"
];
NSString
*
str1
=
[
HTTP_REST_API_BASE_URL
substringToIndex
:
range
.
location
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@"
,
str1
,
str
];
[
imageArr
addObject
:
url
];
}
surveyResult
.
attachmnets
=
imageArr
;
[
_dataArr
addObject
:
surveyResult
];
// [self getDownLoadAttachement:surveyResult];
}
...
...
@@ -119,6 +129,7 @@
SurveyResult
*
survey
=
_dataArr
[
indexPath
.
row
];
cell
.
surveyResult
=
survey
;
cell
.
tag
=
indexPath
.
row
+
BeginTag
;
cell
.
imageBtn
.
tag
=
indexPath
.
row
;
[
cell
.
imageBtn
addTarget
:
self
action
:
@selector
(
imageClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
cell
;
...
...
@@ -130,14 +141,22 @@
-
(
void
)
imageClick
:
(
UIButton
*
)
btn
{
// SurveyResult *result = _dataArr[btn.tag - BeginTag];
//创建详情view
if
(
_resultView
==
nil
)
{
_resultView
=
[[
ResultView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
)];
_resultView
.
delegate
=
self
;
_resultView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
[
_resultView
setScrollView
];
[
AppWindow
addSubview
:
_resultView
];
SurveyResult
*
surveyResult
=
_dataArr
[
btn
.
tag
];
if
(
surveyResult
.
attachmnets
.
count
>
0
)
{
if
(
_resultView
==
nil
)
{
_resultView
=
[[
ResultView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
)];
_resultView
.
images
=
surveyResult
.
attachmnets
;
_resultView
.
delegate
=
self
;
_resultView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
[
_resultView
setScrollView
];
[
AppWindow
addSubview
:
_resultView
];
}
}
}
#pragma mark - resultView协议方法
...
...
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