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
02b8c8df
Commit
02b8c8df
authored
Sep 08, 2015
by
freecui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加行情反馈文件
parent
afb03654
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
3384 additions
and
1 deletion
+3384
-1
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+85
-0
ICRHTTPController.h
XFFruit/Controllers/HTTPController/ICRHTTPController.h
+5
-1
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+34
-0
HGPhWViewController.h
...ers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.h
+26
-0
HGPhWViewController.m
...ers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.m
+296
-0
HGPhoto.h
...ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhoto.h
+40
-0
HGPhoto.m
...ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhoto.m
+236
-0
HGPhotoWall.h
...Controllers/FeedBack/TakePhotos/HGPhotoWall/HGPhotoWall.h
+35
-0
HGPhotoWall.m
...Controllers/FeedBack/TakePhotos/HGPhotoWall/HGPhotoWall.m
+311
-0
AssetsPickerChecked@2x.png
...r/ZYQAssetPicker.Bundle/Images/AssetsPickerChecked@2x.png
+0
-0
AssetsPickerChecked~iOS6@2x.png
...AssetPicker.Bundle/Images/AssetsPickerChecked~iOS6@2x.png
+0
-0
AssetsPickerLocked@2x.png
...er/ZYQAssetPicker.Bundle/Images/AssetsPickerLocked@2x.png
+0
-0
AssetsPickerVideo@2x.png
...ler/ZYQAssetPicker.Bundle/Images/AssetsPickerVideo@2x.png
+0
-0
ZYQAssetPickerController.h
...hotos/ZYQAssetPickerController/ZYQAssetPickerController.h
+136
-0
ZYQAssetPickerController.m
...hotos/ZYQAssetPickerController/ZYQAssetPickerController.m
+1074
-0
SurveyFeedbackListViewController.h
XFFruit/ViewControllers/SurveyFeedbackListViewController.h
+13
-0
SurveyFeedbackListViewController.m
XFFruit/ViewControllers/SurveyFeedbackListViewController.m
+409
-0
WriteFeedbackViewController.h
XFFruit/ViewControllers/WriteFeedbackViewController.h
+20
-0
WriteFeedbackViewController.m
XFFruit/ViewControllers/WriteFeedbackViewController.m
+493
-0
XFDB.h
XFFruit/ViewControllers/XFDB.h
+18
-0
XFDB.m
XFFruit/ViewControllers/XFDB.m
+115
-0
XFPhoto.h
XFFruit/ViewControllers/XFPhoto.h
+18
-0
XFPhoto.m
XFFruit/ViewControllers/XFPhoto.m
+20
-0
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
02b8c8df
...
@@ -57,6 +57,15 @@
...
@@ -57,6 +57,15 @@
35321F671B97EF1100E5C670
/* GXFPopNewMaterialViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F661B97EF1100E5C670
/* GXFPopNewMaterialViewController.m */
;
};
35321F671B97EF1100E5C670
/* GXFPopNewMaterialViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F661B97EF1100E5C670
/* GXFPopNewMaterialViewController.m */
;
};
35321F6A1B97EF3600E5C670
/* GXFPopNewProductViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F691B97EF3600E5C670
/* GXFPopNewProductViewController.m */
;
};
35321F6A1B97EF3600E5C670
/* GXFPopNewProductViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F691B97EF3600E5C670
/* GXFPopNewProductViewController.m */
;
};
35321F6D1B98C66400E5C670
/* GXFButtonAndLineView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F6C1B98C66400E5C670
/* GXFButtonAndLineView.m */
;
};
35321F6D1B98C66400E5C670
/* GXFButtonAndLineView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
35321F6C1B98C66400E5C670
/* GXFButtonAndLineView.m */
;
};
358364721B9EC2D30030779E
/* HGPhoto.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3583646D1B9EC2D30030779E
/* HGPhoto.m */
;
};
358364731B9EC2D30030779E
/* HGPhotoWall.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3583646F1B9EC2D30030779E
/* HGPhotoWall.m */
;
};
358364741B9EC2D30030779E
/* HGPhWViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358364711B9EC2D30030779E
/* HGPhWViewController.m */
;
};
358364781B9EC2EC0030779E
/* ZYQAssetPicker.Bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358364751B9EC2EC0030779E
/* ZYQAssetPicker.Bundle */
;
};
358364791B9EC2EC0030779E
/* ZYQAssetPickerController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358364771B9EC2EC0030779E
/* ZYQAssetPickerController.m */
;
};
358364821B9EC3020030779E
/* SurveyFeedbackListViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3583647B1B9EC3020030779E
/* SurveyFeedbackListViewController.m */
;
};
358364831B9EC3020030779E
/* WriteFeedbackViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3583647D1B9EC3020030779E
/* WriteFeedbackViewController.m */
;
};
358364841B9EC3020030779E
/* XFPhoto.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3583647F1B9EC3020030779E
/* XFPhoto.m */
;
};
358364851B9EC3020030779E
/* XFDB.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358364811B9EC3020030779E
/* XFDB.m */
;
};
358432EE1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432ED1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m */
;
};
358432EE1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432ED1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m */
;
};
358432F11B993BD8007E73ED
/* GXFProcessProductTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432F01B993BD8007E73ED
/* GXFProcessProductTableViewCell.m */
;
};
358432F11B993BD8007E73ED
/* GXFProcessProductTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432F01B993BD8007E73ED
/* GXFProcessProductTableViewCell.m */
;
};
358432F41B994EDD007E73ED
/* GXFListProcessViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432F31B994EDD007E73ED
/* GXFListProcessViewController.m */
;
};
358432F41B994EDD007E73ED
/* GXFListProcessViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
358432F31B994EDD007E73ED
/* GXFListProcessViewController.m */
;
};
...
@@ -505,6 +514,23 @@
...
@@ -505,6 +514,23 @@
35321F691B97EF3600E5C670
/* GXFPopNewProductViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
GXFPopNewProductViewController.m
;
path
=
../Views/GXFPopNewProductViewController.m
;
sourceTree
=
"<group>"
;
};
35321F691B97EF3600E5C670
/* GXFPopNewProductViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
GXFPopNewProductViewController.m
;
path
=
../Views/GXFPopNewProductViewController.m
;
sourceTree
=
"<group>"
;
};
35321F6B1B98C66400E5C670
/* GXFButtonAndLineView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFButtonAndLineView.h
;
sourceTree
=
"<group>"
;
};
35321F6B1B98C66400E5C670
/* GXFButtonAndLineView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFButtonAndLineView.h
;
sourceTree
=
"<group>"
;
};
35321F6C1B98C66400E5C670
/* GXFButtonAndLineView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GXFButtonAndLineView.m
;
sourceTree
=
"<group>"
;
};
35321F6C1B98C66400E5C670
/* GXFButtonAndLineView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GXFButtonAndLineView.m
;
sourceTree
=
"<group>"
;
};
3583646C1B9EC2D30030779E
/* HGPhoto.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HGPhoto.h
;
sourceTree
=
"<group>"
;
};
3583646D1B9EC2D30030779E
/* HGPhoto.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HGPhoto.m
;
sourceTree
=
"<group>"
;
};
3583646E1B9EC2D30030779E
/* HGPhotoWall.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HGPhotoWall.h
;
sourceTree
=
"<group>"
;
};
3583646F1B9EC2D30030779E
/* HGPhotoWall.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HGPhotoWall.m
;
sourceTree
=
"<group>"
;
};
358364701B9EC2D30030779E
/* HGPhWViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HGPhWViewController.h
;
sourceTree
=
"<group>"
;
};
358364711B9EC2D30030779E
/* HGPhWViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HGPhWViewController.m
;
sourceTree
=
"<group>"
;
};
358364751B9EC2EC0030779E
/* ZYQAssetPicker.Bundle */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.plug-in"
;
path
=
ZYQAssetPicker.Bundle
;
sourceTree
=
"<group>"
;
};
358364761B9EC2EC0030779E
/* ZYQAssetPickerController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZYQAssetPickerController.h
;
sourceTree
=
"<group>"
;
};
358364771B9EC2EC0030779E
/* ZYQAssetPickerController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZYQAssetPickerController.m
;
sourceTree
=
"<group>"
;
};
3583647A1B9EC3020030779E
/* SurveyFeedbackListViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
SurveyFeedbackListViewController.h
;
path
=
../SurveyFeedbackListViewController.h
;
sourceTree
=
"<group>"
;
};
3583647B1B9EC3020030779E
/* SurveyFeedbackListViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
SurveyFeedbackListViewController.m
;
path
=
../SurveyFeedbackListViewController.m
;
sourceTree
=
"<group>"
;
};
3583647C1B9EC3020030779E
/* WriteFeedbackViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
WriteFeedbackViewController.h
;
path
=
../WriteFeedbackViewController.h
;
sourceTree
=
"<group>"
;
};
3583647D1B9EC3020030779E
/* WriteFeedbackViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
WriteFeedbackViewController.m
;
path
=
../WriteFeedbackViewController.m
;
sourceTree
=
"<group>"
;
};
3583647E1B9EC3020030779E
/* XFPhoto.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
XFPhoto.h
;
path
=
../XFPhoto.h
;
sourceTree
=
"<group>"
;
};
3583647F1B9EC3020030779E
/* XFPhoto.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
XFPhoto.m
;
path
=
../XFPhoto.m
;
sourceTree
=
"<group>"
;
};
358364801B9EC3020030779E
/* XFDB.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
XFDB.h
;
path
=
../XFDB.h
;
sourceTree
=
"<group>"
;
};
358364811B9EC3020030779E
/* XFDB.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
XFDB.m
;
path
=
../XFDB.m
;
sourceTree
=
"<group>"
;
};
358432EC1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFProcessMaterialTableViewCell.h
;
sourceTree
=
"<group>"
;
};
358432EC1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFProcessMaterialTableViewCell.h
;
sourceTree
=
"<group>"
;
};
358432ED1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GXFProcessMaterialTableViewCell.m
;
sourceTree
=
"<group>"
;
};
358432ED1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GXFProcessMaterialTableViewCell.m
;
sourceTree
=
"<group>"
;
};
358432EF1B993BD8007E73ED
/* GXFProcessProductTableViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFProcessProductTableViewCell.h
;
sourceTree
=
"<group>"
;
};
358432EF1B993BD8007E73ED
/* GXFProcessProductTableViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GXFProcessProductTableViewCell.h
;
sourceTree
=
"<group>"
;
};
...
@@ -1068,6 +1094,55 @@
...
@@ -1068,6 +1094,55 @@
path
=
Views
;
path
=
Views
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
358364681B9EC2B00030779E
/* FeedBack(行情反馈) */
=
{
isa
=
PBXGroup
;
children
=
(
3583647A1B9EC3020030779E
/* SurveyFeedbackListViewController.h */
,
3583647B1B9EC3020030779E
/* SurveyFeedbackListViewController.m */
,
3583647C1B9EC3020030779E
/* WriteFeedbackViewController.h */
,
3583647D1B9EC3020030779E
/* WriteFeedbackViewController.m */
,
3583647E1B9EC3020030779E
/* XFPhoto.h */
,
3583647F1B9EC3020030779E
/* XFPhoto.m */
,
358364801B9EC3020030779E
/* XFDB.h */
,
358364811B9EC3020030779E
/* XFDB.m */
,
358364691B9EC2B00030779E
/* TakePhotos */
,
);
name
=
"FeedBack(行情反馈)"
;
path
=
FeedBack
;
sourceTree
=
"<group>"
;
};
358364691B9EC2B00030779E
/* TakePhotos */
=
{
isa
=
PBXGroup
;
children
=
(
3583646A1B9EC2B00030779E
/* HGPhotoWall */
,
3583646B1B9EC2B00030779E
/* ZYQAssetPickerController */
,
);
path
=
TakePhotos
;
sourceTree
=
"<group>"
;
};
3583646A1B9EC2B00030779E
/* HGPhotoWall */
=
{
isa
=
PBXGroup
;
children
=
(
3583646C1B9EC2D30030779E
/* HGPhoto.h */
,
3583646D1B9EC2D30030779E
/* HGPhoto.m */
,
3583646E1B9EC2D30030779E
/* HGPhotoWall.h */
,
3583646F1B9EC2D30030779E
/* HGPhotoWall.m */
,
358364701B9EC2D30030779E
/* HGPhWViewController.h */
,
358364711B9EC2D30030779E
/* HGPhWViewController.m */
,
);
path
=
HGPhotoWall
;
sourceTree
=
"<group>"
;
};
3583646B1B9EC2B00030779E
/* ZYQAssetPickerController */
=
{
isa
=
PBXGroup
;
children
=
(
358364751B9EC2EC0030779E
/* ZYQAssetPicker.Bundle */
,
358364761B9EC2EC0030779E
/* ZYQAssetPickerController.h */
,
358364771B9EC2EC0030779E
/* ZYQAssetPickerController.m */
,
);
path
=
ZYQAssetPickerController
;
sourceTree
=
"<group>"
;
};
35C3C0BA1AE9587F0035AC8A
/* Navigation */
=
{
35C3C0BA1AE9587F0035AC8A
/* Navigation */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -2073,6 +2148,7 @@
...
@@ -2073,6 +2148,7 @@
C1C6FEED1AB88A3400D4C41A
/* ViewControllers */
=
{
C1C6FEED1AB88A3400D4C41A
/* ViewControllers */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
358364681B9EC2B00030779E
/* FeedBack(行情反馈) */
,
35CF33911B95B419001211EF
/* GXFCommon */
,
35CF33911B95B419001211EF
/* GXFCommon */
,
35CF33721B953E8D001211EF
/* Process(加工单) */
,
35CF33721B953E8D001211EF
/* Process(加工单) */
,
7281A0A71B8974120052B1AC
/* Purchase */
,
7281A0A71B8974120052B1AC
/* Purchase */
,
...
@@ -2385,6 +2461,7 @@
...
@@ -2385,6 +2461,7 @@
C123A9151B25CBAD003C0C36
/* not_selected_star@2x.png in Resources */
,
C123A9151B25CBAD003C0C36
/* not_selected_star@2x.png in Resources */
,
C123A9131B25CBAD003C0C36
/* not_selected_star.png in Resources */
,
C123A9131B25CBAD003C0C36
/* not_selected_star.png in Resources */
,
C123A9171B25CBAD003C0C36
/* selected_star.png in Resources */
,
C123A9171B25CBAD003C0C36
/* selected_star.png in Resources */
,
358364781B9EC2EC0030779E
/* ZYQAssetPicker.Bundle in Resources */
,
C1E0930A1AC8FC94003B7126
/* Localizable.strings in Resources */
,
C1E0930A1AC8FC94003B7126
/* Localizable.strings in Resources */
,
C123A9191B25CBAD003C0C36
/* selected_star@2x.png in Resources */
,
C123A9191B25CBAD003C0C36
/* selected_star@2x.png in Resources */
,
7217E9EF1B72364300FE5C1D
/* maskEnable.png in Resources */
,
7217E9EF1B72364300FE5C1D
/* maskEnable.png in Resources */
,
...
@@ -2462,6 +2539,7 @@
...
@@ -2462,6 +2539,7 @@
FE2FCC821B745E1A00BBC6FB
/* SurveyDetailViewController.m in Sources */
,
FE2FCC821B745E1A00BBC6FB
/* SurveyDetailViewController.m in Sources */
,
0414FF171B94959700C7B00E
/* NewPurchaseNoticeViewController.m in Sources */
,
0414FF171B94959700C7B00E
/* NewPurchaseNoticeViewController.m in Sources */
,
35CF33901B95AF1B001211EF
/* GXFBaseSearchViewController.m in Sources */
,
35CF33901B95AF1B001211EF
/* GXFBaseSearchViewController.m in Sources */
,
358364831B9EC3020030779E
/* WriteFeedbackViewController.m in Sources */
,
FE2FCC8B1B74A9EE00BBC6FB
/* SurveyResultCell.m in Sources */
,
FE2FCC8B1B74A9EE00BBC6FB
/* SurveyResultCell.m in Sources */
,
C182E40E1AD4CE0B009BB9DB
/* IBTModel.m in Sources */
,
C182E40E1AD4CE0B009BB9DB
/* IBTModel.m in Sources */
,
C1FE50411AE0240300C18080
/* IBTAVAudioPlayWrapper.m in Sources */
,
C1FE50411AE0240300C18080
/* IBTAVAudioPlayWrapper.m in Sources */
,
...
@@ -2482,6 +2560,7 @@
...
@@ -2482,6 +2560,7 @@
C142D2B21AC3A155000109A7
/* UIFont+Custom.m in Sources */
,
C142D2B21AC3A155000109A7
/* UIFont+Custom.m in Sources */
,
35D56A831B9D5E7500996C28
/* GXFSeeProcessViewController.m in Sources */
,
35D56A831B9D5E7500996C28
/* GXFSeeProcessViewController.m in Sources */
,
C15295CE1B24741400DF60D1
/* ASValuePopUpView.m in Sources */
,
C15295CE1B24741400DF60D1
/* ASValuePopUpView.m in Sources */
,
358364851B9EC3020030779E
/* XFDB.m in Sources */
,
C159184D1AC062460013B391
/* IBTTableView.m in Sources */
,
C159184D1AC062460013B391
/* IBTTableView.m in Sources */
,
30D1859C1ADBB91000327997
/* ICRAnnouncement.m in Sources */
,
30D1859C1ADBB91000327997
/* ICRAnnouncement.m in Sources */
,
C142D2AE1AC3A155000109A7
/* NSString+TrimmingAdditions.m in Sources */
,
C142D2AE1AC3A155000109A7
/* NSString+TrimmingAdditions.m in Sources */
,
...
@@ -2507,6 +2586,7 @@
...
@@ -2507,6 +2586,7 @@
C159183F1AC062460013B391
/* IBTTableViewInfo.m in Sources */
,
C159183F1AC062460013B391
/* IBTTableViewInfo.m in Sources */
,
7281A0BC1B897EAB0052B1AC
/* PurchaseCell.m in Sources */
,
7281A0BC1B897EAB0052B1AC
/* PurchaseCell.m in Sources */
,
35CF339E1B96E606001211EF
/* GXFWarehouseViewController.m in Sources */
,
35CF339E1B96E606001211EF
/* GXFWarehouseViewController.m in Sources */
,
358364741B9EC2D30030779E
/* HGPhWViewController.m in Sources */
,
C11A34661B24487D00079129
/* ICRAnswer.m in Sources */
,
C11A34661B24487D00079129
/* ICRAnswer.m in Sources */
,
C1D017171AD8EF8100CD9CB8
/* IBTSegmentedControl.m in Sources */
,
C1D017171AD8EF8100CD9CB8
/* IBTSegmentedControl.m in Sources */
,
C10C90901AE54FE300B911CD
/* IBTDatePickerViewController.m in Sources */
,
C10C90901AE54FE300B911CD
/* IBTDatePickerViewController.m in Sources */
,
...
@@ -2532,6 +2612,7 @@
...
@@ -2532,6 +2612,7 @@
C159186B1AC1A03B0013B391
/* ICRSyncViewController.m in Sources */
,
C159186B1AC1A03B0013B391
/* ICRSyncViewController.m in Sources */
,
C1C564431AD66C6E006A1050
/* ICRTaskEditViewController.m in Sources */
,
C1C564431AD66C6E006A1050
/* ICRTaskEditViewController.m in Sources */
,
C142D2AA1AC3A155000109A7
/* NSDate+FormatterAdditions.m in Sources */
,
C142D2AA1AC3A155000109A7
/* NSDate+FormatterAdditions.m in Sources */
,
358364841B9EC3020030779E
/* XFPhoto.m in Sources */
,
C1B307A31ADD199600657F11
/* ICRTaskResultContentView.m in Sources */
,
C1B307A31ADD199600657F11
/* ICRTaskResultContentView.m in Sources */
,
30DB9F971AD7DEC00085FA5C
/* IBTUISearchBar.m in Sources */
,
30DB9F971AD7DEC00085FA5C
/* IBTUISearchBar.m in Sources */
,
7217E9E61B72364300FE5C1D
/* SurveyViewController.m in Sources */
,
7217E9E61B72364300FE5C1D
/* SurveyViewController.m in Sources */
,
...
@@ -2554,6 +2635,7 @@
...
@@ -2554,6 +2635,7 @@
FE7155D91B7B328400595B0A
/* Product.m in Sources */
,
FE7155D91B7B328400595B0A
/* Product.m in Sources */
,
FE4678B61B8D986900B5EDA3
/* PurchaseBoltView.m in Sources */
,
FE4678B61B8D986900B5EDA3
/* PurchaseBoltView.m in Sources */
,
C159188A1AC4615D0013B391
/* ICRHTTPController.m in Sources */
,
C159188A1AC4615D0013B391
/* ICRHTTPController.m in Sources */
,
358364731B9EC2D30030779E
/* HGPhotoWall.m in Sources */
,
C123A90D1B25CBAD003C0C36
/* ASStarRatingView.m in Sources */
,
C123A90D1B25CBAD003C0C36
/* ASStarRatingView.m in Sources */
,
C15295AF1B24296500DF60D1
/* ICRQSingleSelectViewController.m in Sources */
,
C15295AF1B24296500DF60D1
/* ICRQSingleSelectViewController.m in Sources */
,
C167F9C11AC8615B00D2A098
/* ICRLoginContentView.m in Sources */
,
C167F9C11AC8615B00D2A098
/* ICRLoginContentView.m in Sources */
,
...
@@ -2577,6 +2659,7 @@
...
@@ -2577,6 +2659,7 @@
30D702461ADE3862008DC0BF
/* ICRAnnouncementDetailHeadView.m in Sources */
,
30D702461ADE3862008DC0BF
/* ICRAnnouncementDetailHeadView.m in Sources */
,
C17E50D91B09830200C15359
/* ICRPostAttachment.m in Sources */
,
C17E50D91B09830200C15359
/* ICRPostAttachment.m in Sources */
,
C18AEA911AC9B88F00A1DB7B
/* ICRUIAppearance.m in Sources */
,
C18AEA911AC9B88F00A1DB7B
/* ICRUIAppearance.m in Sources */
,
358364821B9EC3020030779E
/* SurveyFeedbackListViewController.m in Sources */
,
C142D2B61AC3A155000109A7
/* UILabel+SizeCalculate.m in Sources */
,
C142D2B61AC3A155000109A7
/* UILabel+SizeCalculate.m in Sources */
,
C15918551AC062460013B391
/* IBTUIViewController.m in Sources */
,
C15918551AC062460013B391
/* IBTUIViewController.m in Sources */
,
C18AEA961AD1425D00A1DB7B
/* ICRDataBaseController.m in Sources */
,
C18AEA961AD1425D00A1DB7B
/* ICRDataBaseController.m in Sources */
,
...
@@ -2659,12 +2742,14 @@
...
@@ -2659,12 +2742,14 @@
C1E108591ADA53C700620375
/* ICRTaskResultViewController.m in Sources */
,
C1E108591ADA53C700620375
/* ICRTaskResultViewController.m in Sources */
,
FEAE16EF1B79CAE3009D9E01
/* SingleScrollView.m in Sources */
,
FEAE16EF1B79CAE3009D9E01
/* SingleScrollView.m in Sources */
,
725581E21B9C26C5001EB0E1
/* BottomTransportView.m in Sources */
,
725581E21B9C26C5001EB0E1
/* BottomTransportView.m in Sources */
,
358364721B9EC2D30030779E
/* HGPhoto.m in Sources */
,
C10C909D1AE56E8700B911CD
/* JTOptionsViewController.m in Sources */
,
C10C909D1AE56E8700B911CD
/* JTOptionsViewController.m in Sources */
,
351CFF5D1B90633700F30866
/* GXFFunctionCollectionViewCell.m in Sources */
,
351CFF5D1B90633700F30866
/* GXFFunctionCollectionViewCell.m in Sources */
,
7281A0B91B897BB20052B1AC
/* PurchaseViewController.m in Sources */
,
7281A0B91B897BB20052B1AC
/* PurchaseViewController.m in Sources */
,
358432EE1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m in Sources */
,
358432EE1B993BAF007E73ED
/* GXFProcessMaterialTableViewCell.m in Sources */
,
C1C5644F1AD6719B006A1050
/* ICRTaskDetailViewController.m in Sources */
,
C1C5644F1AD6719B006A1050
/* ICRTaskDetailViewController.m in Sources */
,
C1E1085D1ADA577500620375
/* ICRTaskDetailContentView.m in Sources */
,
C1E1085D1ADA577500620375
/* ICRTaskDetailContentView.m in Sources */
,
358364791B9EC2EC0030779E
/* ZYQAssetPickerController.m in Sources */
,
C14BE30E1ADB86DB0049F1AA
/* NSData+EncodeAdditions.m in Sources */
,
C14BE30E1ADB86DB0049F1AA
/* NSData+EncodeAdditions.m in Sources */
,
FEA2F3031B8453C700D64735
/* GoodsViewController.m in Sources */
,
FEA2F3031B8453C700D64735
/* GoodsViewController.m in Sources */
,
FE0C9B091B7C543D00335B39
/* User.m in Sources */
,
FE0C9B091B7C543D00335B39
/* User.m in Sources */
,
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.h
View file @
02b8c8df
...
@@ -231,7 +231,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
...
@@ -231,7 +231,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success
:(
void
(
^
)(
id
))
succ
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
failure
:(
void
(
^
)(
id
))
fail
;
// 新增行情反馈(写)
-
(
void
)
surveySaveResultWithDict
:
(
NSDictionary
*
)
dict
surveyUuid
:
(
NSString
*
)
surveyUuid
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
;
//1.7 商品单位
//1.7 商品单位
-
(
void
)
getProductunitWithPage_number
:(
NSUInteger
)
page_number
-
(
void
)
getProductunitWithPage_number
:(
NSUInteger
)
page_number
page_size
:(
NSUInteger
)
page_size
page_size
:(
NSUInteger
)
page_size
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
02b8c8df
...
@@ -1772,6 +1772,40 @@ acceptTypeJson:YES
...
@@ -1772,6 +1772,40 @@ acceptTypeJson:YES
}
}
}
// 新增行情反馈(写)
-
(
void
)
surveySaveResultWithDict
:
(
NSDictionary
*
)
dict
surveyUuid
:
(
NSString
*
)
surveyUuid
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
{
if
(
!
dict
||
!
surveyUuid
)
{
if
(
fail
)
{
fail
(
[[
self
class
]
ErrorWithMsg
:
ERROR_PARAMETER
code
:
0
]
);
}
return
;
}
void
(
^
success
)(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
=
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
CLog
(
@"%@"
,
responseObject
);
if
(
succ
)
{
succ
(
responseObject
);
}
};
void
(
^
failure
)(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
=
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
CLog
(
@"%@"
,
error
);
if
(
fail
)
{
fail
(
error
);
}
};
NSString
*
currentTime
=
[[
NSDate
date
]
httpParameterString
];
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_SurveyFinish
]
stringByAppendingFormat
:
@"/?survey_uuid=%@&time=%@&operId=%@&operName=%@"
,
surveyUuid
,
currentTime
,
userUtil
.
userId
,
userUtil
.
displayName
];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
POST
:
encodeUrlStr
parameters
:
dict
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
}
...
...
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.h
0 → 100644
View file @
02b8c8df
//
// HGPhWViewController.h
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIViewController.h"
#define kimgsFiles @"uploadImgsFiles"
@class
HGPhotoWall
;
@interface
HGPhWViewController
:
IBTUIViewController
@property
(
strong
,
nonatomic
)
HGPhotoWall
*
photoWall
;
@property
(
strong
,
nonatomic
)
NSString
*
url
;
@property
(
strong
,
nonatomic
)
UIImage
*
img
;
//@property (strong, nonatomic) NSMutableArray *phontosChooceMuArr;
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;//全部的照片的data数据
//@property (strong, nonatomic) NSMutableArray *allImgAssets;
+
(
instancetype
)
shareInstance
;
-
(
void
)
addOnePhoto
:
(
UIImage
*
)
img
;
-
(
void
)
addPhotosWithArrayImgs
:
(
NSArray
*
)
arr
;
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhWViewController.m
0 → 100644
View file @
02b8c8df
//
// HGPhWViewController.m
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "HGPhWViewController.h"
#import "HGPhotoWall.h"
#import "HGPhoto.h"
#import "ZYQAssetPickerController.h"
#import "XFDB.h"
#import "XFPhoto.h"
@interface
HGPhWViewController
()
<
HGPhotoWallDelegate
,
UIActionSheetDelegate
,
ZYQAssetPickerControllerDelegate
,
UINavigationControllerDelegate
,
UIScrollViewDelegate
,
UIImagePickerControllerDelegate
>
@property
(
strong
,
nonatomic
)
UIView
*
coverV
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
imgesMuArr
;
//每次从相册中选择的照片
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;
@property
(
strong
,
nonatomic
)
IBTUIButton
*
sureBtn
;
@property
(
strong
,
nonatomic
)
UIScrollView
*
scrollV
;
#define kImagCount 3
#define kPadding (20.0 / 320.0 * self.view.width)/(kImagCount + 1)
#define kImagWH ((self.view.width - (kImagCount + 1.0) * kPadding) / kImagCount)
#define KpaddingPhonto kPadding + kImagWH
@end
@implementation
HGPhWViewController
static
HGPhWViewController
*
_instance
=
nil
;
+
(
instancetype
)
shareInstance
{
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
_instance
=
[[
self
alloc
]
init
];
});
return
_instance
;
}
// 重写init方法
-
(
id
)
init
{
self
=
[
super
init
];
if
(
!
self
)
{
return
nil
;
}
//self.photoWall = [[HGPhotoWall alloc]init];
// [self initHGPhW];
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
self
.
title
=
@"图片预览"
;
[
self
initHGPhW
];
[
self
initData
];
}
-
(
void
)
viewDidDisappear
:
(
BOOL
)
animated
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
kimgsFiles
object
:
self
];
}
-
(
void
)
initData
{
self
.
imgesMuArr
=
[
NSMutableArray
array
];
// self.allImgsMuArr = [NSMutableArray array];
// self.allImgAssets = [NSMutableArray array];
NSArray
*
arrData
=
[[
XFDB
sharedInstance
]
fetchAllPhotosFromLocal
];
for
(
int
count
=
0
;
count
<
arrData
.
count
;
count
++
)
{
XFPhoto
*
xfphoto
=
arrData
[
count
];
[
self
addOnePhoto
:[
UIImage
imageWithData
:
xfphoto
.
photoData
]];
}
}
-
(
void
)
initHGPhW
{
self
.
edgesForExtendedLayout
=
NO
;
// self.sureBtn = [IBTUIButton RoundCornerBtnWithTitle:@"确定上传图片" bgColor:nil];
// _sureBtn.frame = CGRectMake(10, self.view.height - 50 - 64, self.view.width - 20, 40);
// [_sureBtn addTarget:self action:@selector(surePhoto) forControlEvents:UIControlEventTouchUpInside];
// [_sureBtn setBackgroundColor:[UIColor redColor]];
// [self.view addSubview:_sureBtn];
self
.
scrollV
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
width
,
self
.
view
.
height
)];
[
self
.
view
addSubview
:
_scrollV
];
self
.
photoWall
=
[[
HGPhotoWall
alloc
]
init
];
_photoWall
.
backgroundColor
=
[
UIColor
yellowColor
];
_photoWall
.
frame
=
(
CGRect
)
{
.
origin
.
x
=
0
,
.
origin
.
y
=
0
,
.
size
.
width
=
self
.
view
.
width
,
.
size
.
height
=
self
.
scrollV
.
height
};
//self.view.bounds;
_photoWall
.
delegate
=
self
;
#pragma 初始化原来的图片数据 从数据库中读出
[
_photoWall
setPhotos
:
nil
];
//
// @"http://www.weiphone.com/images_v3/logo.png",nil]];
[
_photoWall
setEditModel
:
YES
];
//[self.view addSubview:_photoWall];
_scrollV
.
contentSize
=
_photoWall
.
size
;
[
_scrollV
addSubview
:
_photoWall
];
[
self
scrollViewContentHeight
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
#pragma mark -
#pragma mark 点击图片并放大
//- (void)photoWallPhotoTaped:(NSUInteger)index
//{
-
(
void
)
photoWallPhotoTaped
:
(
HGPhoto
*
)
hgPhoto
{
[
hgPhoto
showImage
];
// UIImageView *imgV = [[UIImageView alloc]init];
// imgV.frame = _coverV.bounds;
// [imgV setImageWithURL:self.photoWall]
// UIActionSheet *actionSheetTemp = [[UIActionSheet alloc] initWithTitle:nil
// delegate:self
// cancelButtonTitle:@"取消"
// destructiveButtonTitle:@"删除图片"
// otherButtonTitles:nil, nil];
// [actionSheetTemp showInView:self.view];
}
-
(
void
)
photoWallPhotoDel
:
(
NSUInteger
)
index
{
[
_photoWall
deletePhotoByIndex
:
index
];
}
-
(
void
)
delCoverV
{
if
(
_coverV
)
{
[
_coverV
removeFromSuperview
];
}
}
-
(
void
)
photoWallMovePhotoFromIndex
:
(
NSInteger
)
index
toIndex
:
(
NSInteger
)
newIndex
{
}
-
(
void
)
photoWallAddAction
{
// [self.photoWall addPhoto:_url];
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
[
self
.
photoWall
addPhotoImg
:
_img
];
}
-
(
void
)
photoWallAddFinish
{
}
-
(
void
)
photoWallDeleteFinish
{
}
#pragma 增加一张照片
-
(
void
)
addOnePhoto
:
(
UIImage
*
)
img
{
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
self
.
img
=
img
;
[
self
.
photoWall
addPhotoImg
:
img
];
NSLog
(
@"%@"
,
NSStringFromCGRect
(
_photoWall
.
frame
));
}
#pragma 增加多张照片
-
(
void
)
addPhotosWithArrayImgs
:
(
NSArray
*
)
arr
{
for
(
UIImage
*
img
in
arr
){
[
self
addOnePhoto
:
img
];
}
}
#pragma 照片选择
-
(
void
)
photowallChoosePhontoes
{
UIActionSheet
*
actionSheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
@"打开照相机"
,
@"从手机相册获取"
,
nil
];
[
actionSheet
showInView
:
self
.
view
];
}
-
(
void
)
actionSheet
:
(
UIActionSheet
*
)
actionSheet
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
switch
(
buttonIndex
)
{
case
0
:
[
self
openCamera
];
break
;
case
1
:
[
self
libraryPhoto
];
break
;
default
:
break
;
}
}
-
(
void
)
openCamera
{
UIImagePickerControllerSourceType
sourceType
=
UIImagePickerControllerSourceTypeCamera
;
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
picker
.
delegate
=
self
;
picker
.
allowsEditing
=
NO
;
picker
.
sourceType
=
sourceType
;
[
self
PresentModalViewController
:
picker
animated
:
YES
];
}
-
(
void
)
libraryPhoto
{
ZYQAssetPickerController
*
assetPicker
=
[[
ZYQAssetPickerController
alloc
]
init
];
assetPicker
.
maximumNumberOfSelection
=
10
;
assetPicker
.
assetsFilter
=
[
ALAssetsFilter
allPhotos
];
assetPicker
.
showEmptyGroups
=
NO
;
assetPicker
.
delegate
=
self
;
// assetPicker.indexPathsForSelectedItems = _allImgAssets;
assetPicker
.
selectionFilter
=
[
NSPredicate
predicateWithBlock
:
^
BOOL
(
id
evaluatedObject
,
NSDictionary
*
bindings
)
{
if
([[(
ALAsset
*
)
evaluatedObject
valueForProperty
:
ALAssetPropertyType
]
isEqual
:
ALAssetTypeVideo
])
{
NSTimeInterval
duration
=
[[(
ALAsset
*
)
evaluatedObject
valueForProperty
:
ALAssetPropertyDuration
]
doubleValue
];
return
duration
>=
5
;
}
else
{
return
YES
;
}
}];
[
self
PresentModalViewController
:
assetPicker
animated
:
YES
];
}
#pragma UIImagePickerControllerDelegate
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
UIImage
*
img
=
[
info
objectForKey
:
UIImagePickerControllerOriginalImage
];
[
self
addOnePhoto
:
img
];
NSData
*
imgData
=
UIImagePNGRepresentation
(
img
);
[
self
savePhotoToDB
:
imgData
];
// [self.allImgsMuArr addObject:imgData];
[
self
scrollViewContentHeight
];
[
picker
DismissModalViewControllerAnimated
:
YES
];
}
#pragma 把选择的图片放入到本地数据库中
-
(
void
)
savePhotoToDB
:
(
NSData
*
)
imgData
{
XFPhoto
*
xfphoto
=
[[
XFPhoto
alloc
]
initWithPhotoData
:
imgData
];
BOOL
isSave
=
[[
XFDB
sharedInstance
]
savePhoto
:
xfphoto
];
if
(
isSave
)
{
NSLog
(
@"保存成功"
);
}
else
{
NSLog
(
@"保存失败"
);
}
}
#pragma mark - ZYQAssetPickerController Delegate
-
(
void
)
assetPickerController
:
(
ZYQAssetPickerController
*
)
picker
didFinishPickingAssets
:
(
NSArray
*
)
assets
{
if
(
_imgesMuArr
.
count
>
0
)
{
[
_imgesMuArr
removeAllObjects
];
}
// dispatch_async(dispatch_get_global_queue(0, 0), ^{
for
(
int
i
=
0
;
i
<
assets
.
count
;
i
++
)
{
ALAsset
*
asset
=
assets
[
i
];
CGImageRef
ref
=
[[
asset
defaultRepresentation
]
fullResolutionImage
];
UIImage
*
img
=
[[
UIImage
alloc
]
initWithCGImage
:
ref
];
NSData
*
imgData
=
UIImagePNGRepresentation
(
img
);
[
self
savePhotoToDB
:
imgData
];
// UIImage *tempImg = [UIImage imageWithCGImage:[asset po]];
[
self
.
imgesMuArr
addObject
:
img
];
//[UIImage imageNamed:@"AttachCamera"]
// [self.allImgsMuArr addObject:imgData];
}
[
self
addPhotosWithArrayImgs
:
_imgesMuArr
];
// });
[
self
scrollViewContentHeight
];
[
picker
popoverPresentationController
];
}
#pragma 调整scrollView内容视图内容高度
-
(
void
)
scrollViewContentHeight
{
NSArray
*
arr
=
[[
XFDB
sharedInstance
]
fetchAllPhotosFromLocal
];
NSInteger
count
=
1
;
if
((
arr
.
count
+
1
)
%
kImagCount
)
{
count
+=
(
arr
.
count
+
1
)
/
kImagCount
+
1
;
}
else
{
count
+=
(
arr
.
count
+
1
)
/
kImagCount
;
}
self
.
photoWall
.
height
=
15
.
0
/
568
*
self
.
view
.
height
+
KpaddingPhonto
*
count
;
self
.
scrollV
.
contentSize
=
_photoWall
.
size
;
}
#pragma 确定选择的照片
-
(
void
)
surePhoto
{
}
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhoto.h
0 → 100644
View file @
02b8c8df
//
// Photo.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class
HGPhoto
;
@protocol
HGPhotoDelegate
<
NSObject
>
@optional
-
(
void
)
photoTaped
:
(
HGPhoto
*
)
photo
;
-
(
void
)
photoMoveFinished
:(
HGPhoto
*
)
photo
;
-
(
void
)
photoDel
:
(
HGPhoto
*
)
photo
;
@end
typedef
NS_ENUM
(
NSInteger
,
PhotoType
)
{
PhotoTypePhoto
=
0
,
//Default
PhotoTypeAdd
=
1
,
};
@interface
HGPhoto
:
UIView
@property
(
assign
)
id
<
HGPhotoDelegate
>
delegate
;
-
(
id
)
initWithOrigin
:(
CGPoint
)
origin
;
-
(
id
)
initWithOrigin
:(
CGPoint
)
origin
andLength
:
(
CGFloat
)
length
;
-
(
void
)
setPhotoType
:(
PhotoType
)
type
;
-
(
PhotoType
)
getPhotoType
;
-
(
void
)
setPhotoUrl
:(
NSString
*
)
photoUrl
;
-
(
void
)
setPhotoImg
:
(
UIImage
*
)
img
;
-
(
void
)
moveToPosition
:(
CGPoint
)
point
;
-
(
void
)
setEditModel
:(
BOOL
)
edit
;
-
(
void
)
showImage
;
//点击扩大图片
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhoto.m
0 → 100644
View file @
02b8c8df
//
// Photo.m
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import "HGPhoto.h"
#import <QuartzCore/QuartzCore.h>
#import "UIImageView+WebCache.h"
static
CGRect
oldframe
;
@interface
HGPhoto
()
<
UIGestureRecognizerDelegate
>
@property
(
strong
,
nonatomic
)
UIView
*
viewMask
;
@property
(
strong
,
nonatomic
)
UIImageView
*
viewPhoto
;
@property
(
strong
,
nonatomic
)
UIButton
*
delBtn
;
@property
(
strong
,
nonatomic
)
NSString
*
stringImageUrl
;
@property
(
nonatomic
)
CGPoint
pointOrigin
;
@property
(
nonatomic
)
BOOL
editModel
;
@property
(
nonatomic
)
PhotoType
type
;
@end
#define kPhotoSize 100. //75//
@implementation
HGPhoto
-
(
id
)
initWithOrigin
:(
CGPoint
)
origin
{
self
=
[
super
initWithFrame
:
CGRectMake
(
origin
.
x
,
origin
.
y
,
kPhotoSize
,
kPhotoSize
)];
if
(
self
)
{
self
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
viewPhoto
=
[[
UIImageView
alloc
]
initWithFrame
:
self
.
bounds
];
self
.
viewPhoto
.
layer
.
cornerRadius
=
12
;
self
.
viewPhoto
.
layer
.
masksToBounds
=
YES
;
self
.
delBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
_delBtn
setBackgroundImage
:[
UIImage
imageNamed
:
@"attachment_delete_btn"
]
forState
:
UIControlStateNormal
];
CGFloat
btnX
=
_viewPhoto
.
frame
.
size
.
width
*
0
.
7
;
CGFloat
btnY
=
0
;
CGFloat
btnW
=
_viewPhoto
.
frame
.
size
.
width
-
btnX
;
_delBtn
.
frame
=
CGRectMake
(
btnX
,
btnY
,
btnW
,
btnW
);
[
_delBtn
addTarget
:
self
action
:
@selector
(
delphoto
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_viewPhoto
addSubview
:
_delBtn
];
self
.
viewMask
=
[[
UIView
alloc
]
initWithFrame
:
self
.
bounds
];
self
.
viewMask
.
alpha
=
0
.
6
;
self
.
viewMask
.
backgroundColor
=
[
UIColor
blackColor
];
self
.
viewMask
.
layer
.
cornerRadius
=
11
;
self
.
viewMask
.
layer
.
masksToBounds
=
YES
;
UITapGestureRecognizer
*
tapRecognizer
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapPress
:
)];
[
self
addSubview
:
self
.
viewPhoto
];
[
self
addSubview
:
self
.
viewMask
];
[
self
addGestureRecognizer
:
tapRecognizer
];
self
.
editModel
=
NO
;
self
.
viewMask
.
hidden
=
YES
;
}
self
.
autoresizingMask
=
UIViewContentModeScaleAspectFill
;
//self.autoresizingMask = UIViewAutoresizingFlexibleWidth & UIViewAutoresizingFlexibleHeight;
return
self
;
}
-
(
id
)
initWithOrigin
:(
CGPoint
)
origin
andLength
:(
CGFloat
)
length
{
self
=
[
self
initWithOrigin
:
origin
];
self
.
viewPhoto
.
size
=
CGSizeMake
(
length
,
length
);
self
.
size
=
CGSizeMake
(
length
,
length
);
return
self
;
}
-
(
void
)
setPhotoType
:(
PhotoType
)
type
{
self
.
type
=
type
;
if
(
type
==
PhotoTypeAdd
)
{
self
.
viewPhoto
.
image
=
[
UIImage
imageNamed
:
@"AttachCamera"
];
//@"addPhoto"];
[
_delBtn
removeFromSuperview
];
}
}
-
(
PhotoType
)
getPhotoType
{
return
self
.
type
;
}
-
(
void
)
setPhotoUrl
:
(
NSString
*
)
photoUrl
{
[
self
.
viewPhoto
setImageWithURL
:[
NSURL
URLWithString
:
photoUrl
]
placeholderImage
:
nil
];
}
-
(
void
)
setPhotoImg
:
(
UIImage
*
)
img
{
[
self
.
viewPhoto
setImage
:
img
];
}
-
(
void
)
moveToPosition
:
(
CGPoint
)
point
{
if
(
self
.
type
==
PhotoTypePhoto
)
{
[
UIView
animateWithDuration
:
0
.
5
animations
:
^
{
self
.
frame
=
CGRectMake
(
point
.
x
,
point
.
y
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
);
}
completion
:
nil
];
}
else
{
self
.
frame
=
CGRectMake
(
point
.
x
,
point
.
y
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
);
}
}
-
(
void
)
setEditModel
:
(
BOOL
)
edit
{
if
(
self
.
type
==
PhotoTypePhoto
)
{
if
(
edit
)
{
UILongPressGestureRecognizer
*
longPressreRecognizer
=
[[
UILongPressGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
handleLongPress
:
)];
longPressreRecognizer
.
delegate
=
self
;
[
self
addGestureRecognizer
:
longPressreRecognizer
];
}
else
{
for
(
UIGestureRecognizer
*
recognizer
in
[
self
gestureRecognizers
])
{
if
([
recognizer
isKindOfClass
:[
UILongPressGestureRecognizer
class
]])
{
[
self
removeGestureRecognizer
:
recognizer
];
break
;
}
}
}
}
}
#pragma btn action
-
(
void
)
delphoto
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoDel
:)])
{
[
self
.
delegate
photoDel
:
self
];
}
}
#pragma mark - UITapGestureRecognizer
-
(
void
)
tapPress
:
(
UITapGestureRecognizer
*
)
tap
//(id)sender
{
//根据点击的位置不同去响应事件
CGMutablePathRef
pathRef
=
CGPathCreateMutable
();
CGPathMoveToPoint
(
pathRef
,
NULL
,
_delBtn
.
frame
.
origin
.
x
,
_delBtn
.
frame
.
origin
.
y
);
CGPathAddLineToPoint
(
pathRef
,
NULL
,
_delBtn
.
frame
.
origin
.
x
,
_delBtn
.
frame
.
origin
.
y
);
CGPathAddLineToPoint
(
pathRef
,
NULL
,
_delBtn
.
frame
.
origin
.
x
+
_delBtn
.
frame
.
size
.
width
,
_delBtn
.
frame
.
origin
.
y
);
CGPathAddLineToPoint
(
pathRef
,
NULL
,
_delBtn
.
frame
.
origin
.
x
,
_delBtn
.
frame
.
origin
.
y
+
_delBtn
.
frame
.
size
.
height
);
CGPathAddLineToPoint
(
pathRef
,
NULL
,
_delBtn
.
frame
.
origin
.
x
+
_delBtn
.
frame
.
size
.
width
,
_delBtn
.
frame
.
origin
.
y
+
_delBtn
.
frame
.
size
.
height
);
CGPathCloseSubpath
(
pathRef
);
CGPoint
p
=
[
tap
locationInView
:
self
];
if
(
CGPathContainsPoint
(
pathRef
,
NULL
,
p
,
NO
))
{
NSLog
(
@"point in path!"
);
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoDel
:)])
{
[
self
.
delegate
photoDel
:
self
];
}
}
else
{
NSLog
(
@"outPoint out path!"
);
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoTaped
:)])
{
[
self
.
delegate
photoTaped
:
self
];
}
}
}
-
(
void
)
handleLongPress
:
(
id
)
sender
{
UILongPressGestureRecognizer
*
recognizer
=
sender
;
CGPoint
point
=
[
recognizer
locationInView
:
self
];
CGFloat
diffx
=
0
.;
CGFloat
diffy
=
0
.;
if
(
UIGestureRecognizerStateBegan
==
recognizer
.
state
)
{
self
.
viewMask
.
hidden
=
NO
;
self
.
pointOrigin
=
point
;
[
self
.
superview
bringSubviewToFront
:
self
];
}
else
if
(
UIGestureRecognizerStateEnded
==
recognizer
.
state
)
{
self
.
viewMask
.
hidden
=
YES
;
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoMoveFinished
:)])
{
[
self
.
delegate
photoMoveFinished
:
self
];
}
}
else
{
diffx
=
point
.
x
-
self
.
pointOrigin
.
x
;
diffy
=
point
.
y
-
self
.
pointOrigin
.
y
;
}
CGFloat
originx
=
self
.
frame
.
origin
.
x
+
diffx
;
CGFloat
originy
=
self
.
frame
.
origin
.
y
+
diffy
;
self
.
frame
=
CGRectMake
(
originx
,
originy
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
);
}
-
(
void
)
showImage
{
UIImage
*
image
=
_viewPhoto
.
image
;
UIWindow
*
window
=
[
UIApplication
sharedApplication
].
keyWindow
;
UIView
*
backgroundView
=
[[
UIView
alloc
]
init
];
backgroundView
.
frame
=
CGRectMake
(
0
,
0
,
[
UIScreen
mainScreen
].
bounds
.
size
.
width
,
[
UIScreen
mainScreen
].
bounds
.
size
.
height
);
oldframe
=
[
_viewPhoto
convertRect
:
_viewPhoto
.
bounds
toView
:
window
];
backgroundView
.
backgroundColor
=
[
UIColor
blackColor
];
backgroundView
.
alpha
=
0
;
UIImageView
*
imageView
=
[[
UIImageView
alloc
]
init
];
imageView
.
image
=
image
;
imageView
.
tag
=
1
;
[
backgroundView
addSubview
:
imageView
];
[
window
addSubview
:
backgroundView
];
UITapGestureRecognizer
*
tap
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
hideImage
:
)];
[
backgroundView
addGestureRecognizer
:
tap
];
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
imageView
.
frame
=
CGRectMake
(
0
,
([
UIScreen
mainScreen
].
bounds
.
size
.
height
-
image
.
size
.
height
*
[
UIScreen
mainScreen
].
bounds
.
size
.
width
/
image
.
size
.
width
)
/
2
,
[
UIScreen
mainScreen
].
bounds
.
size
.
width
,
image
.
size
.
height
*
[
UIScreen
mainScreen
].
bounds
.
size
.
width
/
image
.
size
.
width
);
backgroundView
.
alpha
=
1
;
}
completion
:^
(
BOOL
finished
)
{
}];
}
-
(
void
)
hideImage
:
(
UITapGestureRecognizer
*
)
tap
{
UIView
*
backgroundView
=
tap
.
view
;
UIImageView
*
imageView
=
(
UIImageView
*
)[
tap
.
view
viewWithTag
:
1
];
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
imageView
.
frame
=
oldframe
;
backgroundView
.
alpha
=
0
;
}
completion
:^
(
BOOL
finished
)
{
[
backgroundView
removeFromSuperview
];
}];
}
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhotoWall.h
0 → 100644
View file @
02b8c8df
//
// HGPhotoWall.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class
HGPhoto
;
@protocol
HGPhotoWallDelegate
<
NSObject
>
-
(
void
)
photoWallPhotoDel
:
(
NSUInteger
)
index
;
//删除
-
(
void
)
photoWallPhotoTaped
:(
HGPhoto
*
)
hgPhoto
;
//扩大图片
-
(
void
)
photoWallMovePhotoFromIndex
:(
NSInteger
)
index
toIndex
:(
NSInteger
)
newIndex
;
-
(
void
)
photoWallAddAction
;
-
(
void
)
photoWallAddFinish
;
-
(
void
)
photoWallDeleteFinish
;
-
(
void
)
photowallChoosePhontoes
;
//从相册或相机中取照片
@end
@interface
HGPhotoWall
:
UIView
@property
(
assign
)
id
<
HGPhotoWallDelegate
>
delegate
;
-
(
void
)
setPhotos
:(
NSArray
*
)
photos
;
-
(
void
)
setEditModel
:(
BOOL
)
canEdit
;
-
(
void
)
addPhoto
:(
NSString
*
)
string
;
-
(
void
)
addPhotoImg
:
(
UIImage
*
)
img
;
-
(
void
)
deletePhotoByIndex
:(
NSUInteger
)
index
;
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/HGPhotoWall/HGPhotoWall.m
0 → 100644
View file @
02b8c8df
//
// PhotoWall.m
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import "HGPhotoWall.h"
#import "HGPhoto.h"
@interface
HGPhotoWall
()
<
HGPhotoDelegate
>
@property
(
strong
,
nonatomic
)
UILabel
*
labelDescription
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
arrayPositions
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
arrayPhotos
;
@property
(
nonatomic
)
BOOL
isEditModel
;
@end
#define kImagCount 3
#define kPadding (20.0 / 320.0 * self.width)/(kImagCount + 1)
#define kImagWH ((self.width - (kImagCount + 1.0) * kPadding) / kImagCount)
#define kFrameHeight 95.
#define kFrameHeight2x 175.
#define kImagePositionx @"positionx"
#define kImagePositiony @"positiony"
@implementation
HGPhotoWall
-
(
id
)
initWithFrame
:(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
//CGRectMake(0., 0., 320., 0.)];
if
(
self
)
{
self
.
backgroundColor
=
[
UIColor
darkGrayColor
];
self
.
arrayPositions
=
[
NSMutableArray
arrayWithCapacity
:
1
];
self
.
arrayPhotos
=
[
NSMutableArray
arrayWithCapacity
:
1
];
self
.
labelDescription
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
.,
0
.,
300
.,
18
.)];
self
.
labelDescription
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
labelDescription
.
textColor
=
[
UIColor
whiteColor
];
self
.
labelDescription
.
font
=
[
UIFont
systemFontOfSize
:
12
.];
self
.
labelDescription
.
textAlignment
=
NSTextAlignmentLeft
;
[
self
addSubview
:
self
.
labelDescription
];
self
.
labelDescription
.
hidden
=
YES
;
self
.
labelDescription
.
text
=
@"拖拽图片可以排列顺序, 点击添加照片."
;
}
return
self
;
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
}
-
(
void
)
setPhotos
:
(
NSArray
*
)
photos
{
NSInteger
col
=
photos
.
count
%
kImagCount
;
//列
NSInteger
row
=
photos
.
count
/
kImagCount
;
//行
CGFloat
x
,
y
;
for
(
int
irow
=
0
;
irow
<
row
+
1
;
irow
++
)
{
y
=
15
.
0
/
568
*
self
.
height
+
kImagWH
*
irow
+
irow
*
kPadding
;
if
(
irow
<
row
)
{
for
(
int
jcol
=
0
;
jcol
<
kImagCount
;
jcol
++
)
{
x
=
kPadding
*
(
jcol
+
1
)
+
kImagWH
*
jcol
;
[
self
.
arrayPositions
addObject
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
NSString
stringWithFormat
:
@"%f"
,
x
],
kImagePositionx
,[
NSString
stringWithFormat
:
@"%f"
,
y
],
kImagePositiony
,
nil
]
];
}
}
else
{
for
(
int
jcol
=
0
;
jcol
<
col
+
1
;
jcol
++
)
{
//col+1 表示多加的add按钮的位置
x
=
kPadding
*
(
jcol
+
1
)
+
kImagWH
*
jcol
;
[
self
.
arrayPositions
addObject
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
NSString
stringWithFormat
:
@"%f"
,
x
],
kImagePositionx
,[
NSString
stringWithFormat
:
@"%f"
,
y
],
kImagePositiony
,
nil
]
];
}
}
}
[
self
.
arrayPhotos
removeAllObjects
];
NSUInteger
count
=
[
photos
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
i
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
HGPhoto
*
photoTemp
=
[[
HGPhoto
alloc
]
initWithOrigin
:
CGPointMake
(
originx
,
originy
)
andLength
:
kImagWH
];
//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)];
photoTemp
.
delegate
=
self
;
[
photoTemp
setPhotoUrl
:[
photos
objectAtIndex
:
i
]];
[
self
addSubview
:
photoTemp
];
[
self
.
arrayPhotos
addObject
:
photoTemp
];
}
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
count
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
HGPhoto
*
photoTemp
=
[[
HGPhoto
alloc
]
initWithOrigin
:
CGPointMake
(
originx
,
originy
)
andLength
:
kImagWH
];
//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)];
photoTemp
.
delegate
=
self
;
photoTemp
.
hidden
=
YES
;
[
photoTemp
setPhotoType
:
PhotoTypeAdd
];
[
self
.
arrayPhotos
addObject
:
photoTemp
];
[
self
addSubview
:
photoTemp
];
CGFloat
frameHeight
=
-
1
;
if
(
count
>
kImagCount
)
{
frameHeight
=
kFrameHeight2x
;
}
else
{
frameHeight
=
kFrameHeight
;
}
//self.frame = CGRectMake(0., 0., 320., frameHeight);
}
-
(
void
)
setEditModel
:
(
BOOL
)
canEdit
{
self
.
isEditModel
=
canEdit
;
if
(
self
.
isEditModel
)
{
HGPhoto
*
viewTemp
=
[
self
.
arrayPhotos
lastObject
];
viewTemp
.
hidden
=
NO
;
self
.
labelDescription
.
hidden
=
NO
;
}
else
{
HGPhoto
*
viewTemp
=
[
self
.
arrayPhotos
lastObject
];
viewTemp
.
hidden
=
YES
;
self
.
labelDescription
.
hidden
=
YES
;
}
NSUInteger
count
=
[
self
.
arrayPhotos
count
]
-
1
;
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
HGPhoto
*
viewTemp
=
[
self
.
arrayPhotos
objectAtIndex
:
i
];
[
viewTemp
setEditModel
:
self
.
isEditModel
];
}
[
self
reloadPhotos
:
NO
];
}
-
(
void
)
addPhoto
:
(
NSString
*
)
string
{
NSInteger
col
=
_arrayPositions
.
count
%
kImagCount
;
NSInteger
row
=
_arrayPositions
.
count
/
kImagCount
;
CGFloat
x
,
y
;
x
=
kPadding
*
(
col
+
1
)
+
kImagCount
*
col
;
y
=
15
.
0
/
568
*
self
.
height
+
kImagWH
*
row
+
row
*
kPadding
;
[
self
.
arrayPositions
addObject
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
NSString
stringWithFormat
:
@"%f"
,
x
],
kImagePositionx
,[
NSString
stringWithFormat
:
@"%f"
,
y
],
kImagePositiony
,
nil
]
];
// if (_arrayPositions.count % 4 ) {
// <#statements#>
// }
NSUInteger
index
=
[
self
.
arrayPhotos
count
]
-
1
;
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
index
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
HGPhoto
*
photoTemp
=
[[
HGPhoto
alloc
]
initWithOrigin
:
CGPointMake
(
originx
,
originy
)
andLength
:
kImagWH
];
//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)];
photoTemp
.
delegate
=
self
;
[
photoTemp
setPhotoUrl
:
string
];
[
self
.
arrayPhotos
insertObject
:
photoTemp
atIndex
:
index
];
[
self
addSubview
:
photoTemp
];
[
self
reloadPhotos
:
YES
];
}
#pragma 通过获取相册里面的图片资源来
-
(
void
)
addPhotoImg
:
(
UIImage
*
)
img
{
NSInteger
col
=
_arrayPositions
.
count
%
kImagCount
;
NSInteger
row
=
_arrayPositions
.
count
/
kImagCount
;
CGFloat
x
,
y
;
// NSLog(@"%lf, %lf",kPadding,kImagWH);
x
=
kPadding
*
(
col
+
1
)
+
kImagWH
*
col
;
y
=
15
.
0
/
568
*
self
.
height
+
kImagWH
*
row
+
kPadding
*
row
;
[
self
.
arrayPositions
addObject
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
NSString
stringWithFormat
:
@"%f"
,
x
],
kImagePositionx
,[
NSString
stringWithFormat
:
@"%f"
,
y
],
kImagePositiony
,
nil
]
];
NSUInteger
index
=
[
self
.
arrayPhotos
count
]
-
1
;
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
index
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
HGPhoto
*
photoTemp
=
[[
HGPhoto
alloc
]
initWithOrigin
:
CGPointMake
(
originx
,
originy
)
andLength
:
kImagWH
];
//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)];
photoTemp
.
delegate
=
self
;
[
photoTemp
setPhotoImg
:
img
];
[
self
.
arrayPhotos
insertObject
:
photoTemp
atIndex
:
index
];
[
self
addSubview
:
photoTemp
];
[
self
reloadPhotos
:
YES
];
}
-
(
void
)
deletePhotoByIndex
:
(
NSUInteger
)
index
{
[
_arrayPositions
removeLastObject
];
HGPhoto
*
photoTemp
=
[
self
.
arrayPhotos
objectAtIndex
:
index
];
[
self
.
arrayPhotos
removeObject
:
photoTemp
];
[
photoTemp
removeFromSuperview
];
[
self
reloadPhotos
:
YES
];
}
#pragma mark - Photo
-
(
void
)
photoTaped
:
(
HGPhoto
*
)
photo
{
NSUInteger
type
=
[
photo
getPhotoType
];
if
(
type
==
PhotoTypeAdd
)
{
// if ([self.delegate respondsToSelector:@selector(photoWallAddAction)]) {
// [self.delegate photoWallAddAction];
// }
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photowallChoosePhontoes
)])
{
[
self
.
delegate
photowallChoosePhontoes
];
}
}
else
if
(
type
==
PhotoTypePhoto
)
{
NSUInteger
index
=
[
self
.
arrayPhotos
indexOfObject
:
photo
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoWallPhotoTaped
:)])
{
[
self
.
delegate
photoWallPhotoTaped
:
photo
];
//[self.delegate photoWallPhotoDel:index];
}
}
}
-
(
void
)
photoDel
:
(
HGPhoto
*
)
photo
{
NSUInteger
type
=
[
photo
getPhotoType
];
if
(
type
==
PhotoTypePhoto
)
{
NSUInteger
index
=
[
self
.
arrayPhotos
indexOfObject
:
photo
];
[
self
.
delegate
photoWallPhotoDel
:
index
];
}
}
//- (void)photoDel:(HGPhoto *)photo {
// NSUInteger type = [photo getPhotoType];
// if (type == PhotoTypePhoto) {
// NSUInteger index = [self.arrayPhotos indexOfObject:photo];
// [self.delegate ph]
// }
//}
-
(
void
)
photoMoveFinished
:
(
HGPhoto
*
)
photo
{
CGPoint
pointPhoto
=
CGPointMake
(
photo
.
frame
.
origin
.
x
,
photo
.
frame
.
origin
.
y
);
CGFloat
space
=
-
1
;
NSUInteger
oldIndex
=
[
self
.
arrayPhotos
indexOfObject
:
photo
];
NSUInteger
newIndex
=
-
1
;
NSUInteger
count
=
[
self
.
arrayPhotos
count
]
-
1
;
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
i
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
CGPoint
pointTemp
=
CGPointMake
(
originx
,
originy
);
CGFloat
spaceTemp
=
[
self
spaceToPoint
:
pointPhoto
FromPoint
:
pointTemp
];
if
(
space
<
0
)
{
space
=
spaceTemp
;
newIndex
=
i
;
}
else
{
if
(
spaceTemp
<
space
)
{
space
=
spaceTemp
;
newIndex
=
i
;
}
}
}
[
self
.
arrayPhotos
removeObject
:
photo
];
[
self
.
arrayPhotos
insertObject
:
photo
atIndex
:
newIndex
];
[
self
reloadPhotos
:
NO
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
photoWallMovePhotoFromIndex
:
toIndex
:
)])
{
[
self
.
delegate
photoWallMovePhotoFromIndex
:
oldIndex
toIndex
:
newIndex
];
}
}
-
(
void
)
reloadPhotos
:
(
BOOL
)
add
{
NSUInteger
count
=
-
1
;
if
(
add
)
{
count
=
[
self
.
arrayPhotos
count
];
}
else
{
count
=
[
self
.
arrayPhotos
count
]
-
1
;
}
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
NSDictionary
*
dictionaryTemp
=
[
self
.
arrayPositions
objectAtIndex
:
i
];
CGFloat
originx
=
[[
dictionaryTemp
objectForKey
:
kImagePositionx
]
floatValue
];
CGFloat
originy
=
[[
dictionaryTemp
objectForKey
:
kImagePositiony
]
floatValue
];
HGPhoto
*
photoTemp
=
[
self
.
arrayPhotos
objectAtIndex
:
i
];
[
photoTemp
moveToPosition
:
CGPointMake
(
originx
,
originy
)];
}
CGFloat
frameHeight
=
-
1
;
NSUInteger
countPhoto
=
[
self
.
arrayPhotos
count
];
if
(
self
.
isEditModel
)
{
if
(
countPhoto
>
kImagCount
)
{
frameHeight
=
kFrameHeight2x
+
20
.;
}
else
{
frameHeight
=
kFrameHeight
+
20
.;
}
self
.
labelDescription
.
frame
=
CGRectMake
(
self
.
labelDescription
.
frame
.
origin
.
x
,
frameHeight
-
20
.,
self
.
labelDescription
.
frame
.
size
.
width
,
self
.
labelDescription
.
frame
.
size
.
height
);
}
else
{
if
(
countPhoto
>
5
)
{
frameHeight
=
kFrameHeight2x
;
}
else
{
frameHeight
=
kFrameHeight
;
}
}
// self.frame = CGRectMake(0., 0., 320., frameHeight);
}
-
(
CGFloat
)
spaceToPoint
:
(
CGPoint
)
point
FromPoint
:
(
CGPoint
)
otherPoint
{
float
x
=
point
.
x
-
otherPoint
.
x
;
float
y
=
point
.
y
-
otherPoint
.
y
;
return
sqrt
(
x
*
x
+
y
*
y
);
}
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPicker.Bundle/Images/AssetsPickerChecked@2x.png
0 → 100755
View file @
02b8c8df
1.06 KB
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPicker.Bundle/Images/AssetsPickerChecked~iOS6@2x.png
0 → 100755
View file @
02b8c8df
3.62 KB
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPicker.Bundle/Images/AssetsPickerLocked@2x.png
0 → 100755
View file @
02b8c8df
13.3 KB
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPicker.Bundle/Images/AssetsPickerVideo@2x.png
0 → 100755
View file @
02b8c8df
194 Bytes
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPickerController.h
0 → 100755
View file @
02b8c8df
//
// ZYQAssetPickerController.h
// ZYQAssetPickerControllerDemo
//
// Created by Zhao Yiqi on 13-12-25.
// Copyright (c) 2013年 heroims. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>
#pragma mark - ZYQAssetPickerController
@protocol
ZYQAssetPickerControllerDelegate
;
@interface
ZYQAssetPickerController
:
UINavigationController
@property
(
nonatomic
,
weak
)
id
<
UINavigationControllerDelegate
,
ZYQAssetPickerControllerDelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
ALAssetsFilter
*
assetsFilter
;
@property
(
nonatomic
,
copy
,
readonly
)
NSArray
*
indexPathsForSelectedItems
;
@property
(
nonatomic
,
assign
)
NSInteger
maximumNumberOfSelection
;
@property
(
nonatomic
,
assign
)
NSInteger
minimumNumberOfSelection
;
@property
(
nonatomic
,
strong
)
NSPredicate
*
selectionFilter
;
@property
(
nonatomic
,
assign
)
BOOL
showCancelButton
;
@property
(
nonatomic
,
assign
)
BOOL
showEmptyGroups
;
@property
(
nonatomic
,
assign
)
BOOL
isFinishDismissViewController
;
@end
@protocol
ZYQAssetPickerControllerDelegate
<
NSObject
>
-
(
void
)
assetPickerController
:
(
ZYQAssetPickerController
*
)
picker
didFinishPickingAssets
:
(
NSArray
*
)
assets
;
@optional
-
(
void
)
assetPickerControllerDidCancel
:
(
ZYQAssetPickerController
*
)
picker
;
-
(
void
)
assetPickerController
:(
ZYQAssetPickerController
*
)
picker
didSelectAsset
:(
ALAsset
*
)
asset
;
-
(
void
)
assetPickerController
:(
ZYQAssetPickerController
*
)
picker
didDeselectAsset
:(
ALAsset
*
)
asset
;
-
(
void
)
assetPickerControllerDidMaximum
:(
ZYQAssetPickerController
*
)
picker
;
-
(
void
)
assetPickerControllerDidMinimum
:(
ZYQAssetPickerController
*
)
picker
;
@end
#pragma mark - ZYQAssetViewController
@interface
ZYQAssetViewController
:
UITableViewController
@property
(
nonatomic
,
strong
)
ALAssetsGroup
*
assetsGroup
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
indexPathsForSelectedItems
;
@end
#pragma mark - ZYQVideoTitleView
@interface
ZYQVideoTitleView
:
UILabel
@end
#pragma mark - ZYQTapAssetView
@protocol
ZYQTapAssetViewDelegate
<
NSObject
>
-
(
void
)
touchSelect
:
(
BOOL
)
select
;
-
(
BOOL
)
shouldTap
;
@end
@interface
ZYQTapAssetView
:
UIView
@property
(
nonatomic
,
assign
)
BOOL
selected
;
@property
(
nonatomic
,
assign
)
BOOL
disabled
;
@property
(
nonatomic
,
weak
)
id
<
ZYQTapAssetViewDelegate
>
delegate
;
@end
#pragma mark - ZYQAssetView
@protocol
ZYQAssetViewDelegate
<
NSObject
>
-
(
BOOL
)
shouldSelectAsset
:
(
ALAsset
*
)
asset
;
-
(
void
)
tapSelectHandle
:(
BOOL
)
select
asset
:(
ALAsset
*
)
asset
;
@end
@interface
ZYQAssetView
:
UIView
-
(
void
)
bind
:(
ALAsset
*
)
asset
selectionFilter
:(
NSPredicate
*
)
selectionFilter
isSeleced
:(
BOOL
)
isSeleced
;
@end
#pragma mark - ZYQAssetViewCell
@protocol
ZYQAssetViewCellDelegate
;
@interface
ZYQAssetViewCell
:
UITableViewCell
@property
(
nonatomic
,
weak
)
id
<
ZYQAssetViewCellDelegate
>
delegate
;
-
(
void
)
bind
:(
NSArray
*
)
assets
selectionFilter
:(
NSPredicate
*
)
selectionFilter
minimumInteritemSpacing
:(
float
)
minimumInteritemSpacing
minimumLineSpacing
:(
float
)
minimumLineSpacing
columns
:(
int
)
columns
assetViewX
:(
float
)
assetViewX
;
@end
@protocol
ZYQAssetViewCellDelegate
<
NSObject
>
-
(
BOOL
)
shouldSelectAsset
:
(
ALAsset
*
)
asset
;
-
(
void
)
didSelectAsset
:(
ALAsset
*
)
asset
;
-
(
void
)
didDeselectAsset
:(
ALAsset
*
)
asset
;
@end
#pragma mark - ZYQAssetGroupViewCell
@interface
ZYQAssetGroupViewCell
:
UITableViewCell
-
(
void
)
bind
:(
ALAssetsGroup
*
)
assetsGroup
;
@end
#pragma mark - ZYQAssetGroupViewController
@interface
ZYQAssetGroupViewController
:
UITableViewController
@end
XFFruit/ViewControllers/FeedBack/TakePhotos/ZYQAssetPickerController/ZYQAssetPickerController.m
0 → 100755
View file @
02b8c8df
//
// ZYQAssetPickerController.m
// ZYQAssetPickerControllerDemo
//
// Created by Zhao Yiqi on 13-12-25.
// Copyright (c) 2013年 heroims. All rights reserved.
//
#import "ZYQAssetPickerController.h"
#define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending)
#define kThumbnailLength 78.0f
#define kThumbnailSize CGSizeMake(kThumbnailLength, kThumbnailLength)
#define kPopoverContentSize CGSizeMake(320, 480)
#pragma mark -
@interface
NSDate
(
TimeInterval
)
+
(
NSDateComponents
*
)
componetsWithTimeInterval
:(
NSTimeInterval
)
timeInterval
;
+
(
NSString
*
)
timeDescriptionOfTimeInterval
:(
NSTimeInterval
)
timeInterval
;
@end
@implementation
NSDate
(
TimeInterval
)
+
(
NSDateComponents
*
)
componetsWithTimeInterval
:(
NSTimeInterval
)
timeInterval
{
NSCalendar
*
calendar
=
[
NSCalendar
currentCalendar
];
NSDate
*
date1
=
[[
NSDate
alloc
]
init
];
NSDate
*
date2
=
[[
NSDate
alloc
]
initWithTimeInterval
:
timeInterval
sinceDate
:
date1
];
unsigned
int
unitFlags
=
NSSecondCalendarUnit
|
NSMinuteCalendarUnit
|
NSHourCalendarUnit
|
NSDayCalendarUnit
|
NSMonthCalendarUnit
|
NSYearCalendarUnit
;
return
[
calendar
components
:
unitFlags
fromDate
:
date1
toDate:
date2
options:
0
];
}
+
(
NSString
*
)
timeDescriptionOfTimeInterval
:(
NSTimeInterval
)
timeInterval
{
NSDateComponents
*
components
=
[
self
.
class
componetsWithTimeInterval
:
timeInterval
];
NSInteger
roundedSeconds
=
lround
(
timeInterval
-
(
components
.
hour
*
60
)
-
(
components
.
minute
*
60
*
60
));
if
(
components
.
hour
>
0
)
{
return
[
NSString
stringWithFormat
:
@"%ld:%02ld:%02ld"
,
(
long
)
components
.
hour
,
(
long
)
components
.
minute
,
(
long
)
roundedSeconds
];
}
else
{
return
[
NSString
stringWithFormat
:
@"%ld:%02ld"
,
(
long
)
components
.
minute
,
(
long
)
roundedSeconds
];
}
}
@end
#pragma mark - ZYQAssetPickerController
@interface
ZYQAssetPickerController
()
@property
(
nonatomic
,
copy
)
NSArray
*
indexPathsForSelectedItems
;
@end
#pragma mark - ZYQVideoTitleView
@implementation
ZYQVideoTitleView
-
(
void
)
drawRect
:(
CGRect
)
rect
{
CGFloat
colors
[]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
8
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
};
CGFloat
locations
[]
=
{
0
.
0
,
0
.
75
,
1
.
0
};
CGColorSpaceRef
baseSpace
=
CGColorSpaceCreateDeviceRGB
();
CGGradientRef
gradient
=
CGGradientCreateWithColorComponents
(
baseSpace
,
colors
,
locations
,
2
);
CGContextRef
context
=
UIGraphicsGetCurrentContext
();
CGFloat
height
=
rect
.
size
.
height
;
CGPoint
startPoint
=
CGPointMake
(
CGRectGetMidX
(
rect
),
height
);
CGPoint
endPoint
=
CGPointMake
(
CGRectGetMidX
(
rect
),
CGRectGetMaxY
(
rect
));
CGContextDrawLinearGradient
(
context
,
gradient
,
startPoint
,
endPoint
,
kCGGradientDrawsBeforeStartLocation
);
CGSize
titleSize
=
[
self
.
text
sizeWithFont
:
self
.
font
];
[
self
.
textColor
set
];
[
self
.
text
drawAtPoint
:
CGPointMake
(
rect
.
size
.
width
-
titleSize
.
width
-
2
,
(
height
-
12
)
/
2
)
forWidth
:
kThumbnailLength
withFont:
self
.
font
fontSize:
12
lineBreakMode:
NSLineBreakByTruncatingTail
baselineAdjustment:
UIBaselineAdjustmentAlignCenters
];
UIImage
*
videoIcon
=
[
UIImage
imageWithContentsOfFile
:[[[
NSBundle
mainBundle
]
resourcePath
]
stringByAppendingPathComponent
:
@"ZYQAssetPicker.Bundle/Images/AssetsPickerVideo@2x.png"
]];
[
videoIcon
drawAtPoint
:
CGPointMake
(
2
,
(
height
-
videoIcon
.
size
.
height
)
/
2
)];
}
@end
#pragma mark - ZYQTapAssetView
@interface
ZYQTapAssetView
()
@property
(
nonatomic
,
retain
)
UIImageView
*
selectView
;
@end
@implementation
ZYQTapAssetView
static
UIImage
*
checkedIcon
;
static
UIColor
*
selectedColor
;
static
UIColor
*
disabledColor
;
+
(
void
)
initialize
{
checkedIcon
=
[
UIImage
imageWithContentsOfFile
:[[[
NSBundle
mainBundle
]
resourcePath
]
stringByAppendingPathComponent
:[
NSString
stringWithFormat
:
@"ZYQAssetPicker.Bundle/Images/%@@2x.png"
,(
!
IS_IOS7
)
?
@"AssetsPickerChecked~iOS6"
:
@"AssetsPickerChecked"
]]];
selectedColor
=
[
UIColor
colorWithWhite
:
1
alpha
:
0
.
3
];
disabledColor
=
[
UIColor
colorWithWhite
:
1
alpha
:
0
.
9
];
}
-
(
id
)
initWithFrame
:
(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
_selectView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
frame
.
size
.
width
-
checkedIcon
.
size
.
width
,
frame
.
size
.
height
-
checkedIcon
.
size
.
height
,
checkedIcon
.
size
.
width
,
checkedIcon
.
size
.
height
)];
[
self
addSubview
:
_selectView
];
}
return
self
;
}
-
(
void
)
touchesEnded
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
if
(
_disabled
)
{
return
;
}
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
shouldTap
)])
{
if
(
!
[
_delegate
shouldTap
]
&&!
_selected
)
{
return
;
}
}
if
((
_selected
=!
_selected
))
{
self
.
backgroundColor
=
selectedColor
;
[
_selectView
setImage
:
checkedIcon
];
}
else
{
self
.
backgroundColor
=
[
UIColor
clearColor
];
[
_selectView
setImage
:
nil
];
}
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
touchSelect
:)])
{
[
_delegate
touchSelect
:
_selected
];
}
}
-
(
void
)
setDisabled
:
(
BOOL
)
disabled
{
_disabled
=
disabled
;
if
(
_disabled
)
{
self
.
backgroundColor
=
disabledColor
;
}
else
{
self
.
backgroundColor
=
[
UIColor
clearColor
];
}
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
{
if
(
_disabled
)
{
self
.
backgroundColor
=
disabledColor
;
[
_selectView
setImage
:
nil
];
return
;
}
_selected
=
selected
;
if
(
_selected
)
{
self
.
backgroundColor
=
selectedColor
;
[
_selectView
setImage
:
checkedIcon
];
}
else
{
self
.
backgroundColor
=
[
UIColor
clearColor
];
[
_selectView
setImage
:
nil
];
}
}
@end
#pragma mark - ZYQAssetView
@interface
ZYQAssetView
()
<
ZYQTapAssetViewDelegate
>
@property
(
nonatomic
,
strong
)
ALAsset
*
asset
;
@property
(
nonatomic
,
weak
)
id
<
ZYQAssetViewDelegate
>
delegate
;
@property
(
nonatomic
,
retain
)
UIImageView
*
imageView
;
@property
(
nonatomic
,
retain
)
ZYQVideoTitleView
*
videoTitle
;
@property
(
nonatomic
,
retain
)
ZYQTapAssetView
*
tapAssetView
;
@end
@implementation
ZYQAssetView
static
UIFont
*
titleFont
=
nil
;
static
CGFloat
titleHeight
;
static
UIColor
*
titleColor
;
+
(
void
)
initialize
{
titleFont
=
[
UIFont
systemFontOfSize
:
12
];
titleHeight
=
20
.
0
f
;
titleColor
=
[
UIColor
whiteColor
];
}
-
(
id
)
initWithFrame
:
(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
self
.
opaque
=
YES
;
self
.
isAccessibilityElement
=
YES
;
self
.
accessibilityTraits
=
UIAccessibilityTraitImage
;
_imageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kThumbnailSize
.
width
,
kThumbnailSize
.
height
)];
[
self
addSubview
:
_imageView
];
_videoTitle
=
[[
ZYQVideoTitleView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
kThumbnailSize
.
height
-
20
,
kThumbnailSize
.
width
,
titleHeight
)];
_videoTitle
.
hidden
=
YES
;
_videoTitle
.
font
=
titleFont
;
_videoTitle
.
textColor
=
titleColor
;
_videoTitle
.
textAlignment
=
NSTextAlignmentRight
;
_videoTitle
.
backgroundColor
=
[
UIColor
clearColor
];
[
self
addSubview
:
_videoTitle
];
_tapAssetView
=
[[
ZYQTapAssetView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
frame
.
size
.
width
,
frame
.
size
.
height
)];
_tapAssetView
.
delegate
=
self
;
[
self
addSubview
:
_tapAssetView
];
}
return
self
;
}
-
(
void
)
bind
:
(
ALAsset
*
)
asset
selectionFilter
:
(
NSPredicate
*
)
selectionFilter
isSeleced
:
(
BOOL
)
isSeleced
{
self
.
asset
=
asset
;
[
_imageView
setImage
:[
UIImage
imageWithCGImage
:
asset
.
thumbnail
]];
if
([[
asset
valueForProperty
:
ALAssetPropertyType
]
isEqual
:
ALAssetTypeVideo
])
{
_videoTitle
.
hidden
=
NO
;
_videoTitle
.
text
=
[
NSDate
timeDescriptionOfTimeInterval
:[[
asset
valueForProperty
:
ALAssetPropertyDuration
]
doubleValue
]];
}
else
{
_videoTitle
.
hidden
=
YES
;
}
_tapAssetView
.
disabled
=!
[
selectionFilter
evaluateWithObject
:
asset
];
_tapAssetView
.
selected
=
isSeleced
;
}
#pragma mark - ZYQTapAssetView Delegate
-
(
BOOL
)
shouldTap
{
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
shouldSelectAsset
:)])
{
return
[
_delegate
shouldSelectAsset
:
_asset
];
}
return
YES
;
}
-
(
void
)
touchSelect
:
(
BOOL
)
select
{
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
tapSelectHandle
:
asset
:
)])
{
[
_delegate
tapSelectHandle
:
select
asset
:
_asset
];
}
}
@end
#pragma mark - ZYQAssetViewCell
@interface
ZYQAssetViewCell
()
<
ZYQAssetViewDelegate
>
@end
@class
ZYQAssetViewController
;
@implementation
ZYQAssetViewCell
-
(
id
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
([
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
[
self
setSelectionStyle
:
UITableViewCellSelectionStyleNone
];
}
return
self
;
}
-
(
void
)
bind
:(
NSArray
*
)
assets
selectionFilter
:(
NSPredicate
*
)
selectionFilter
minimumInteritemSpacing
:(
float
)
minimumInteritemSpacing
minimumLineSpacing
:(
float
)
minimumLineSpacing
columns
:(
int
)
columns
assetViewX
:(
float
)
assetViewX
{
if
(
self
.
contentView
.
subviews
.
count
<
assets
.
count
)
{
for
(
int
i
=
0
;
i
<
assets
.
count
;
i
++
)
{
if
(
i
>
((
NSInteger
)
self
.
contentView
.
subviews
.
count
-
1
))
{
ZYQAssetView
*
assetView
=
[[
ZYQAssetView
alloc
]
initWithFrame
:
CGRectMake
(
assetViewX
+
(
kThumbnailSize
.
width
+
minimumInteritemSpacing
)
*
i
,
minimumLineSpacing
-
1
,
kThumbnailSize
.
width
,
kThumbnailSize
.
height
)];
[
assetView
bind
:
assets
[
i
]
selectionFilter
:
selectionFilter
isSeleced
:
[((
ZYQAssetViewController
*
)
_delegate
).
indexPathsForSelectedItems
containsObject
:
assets
[
i
]]];
assetView
.
delegate
=
self
;
[
self
.
contentView
addSubview
:
assetView
];
}
else
{
((
ZYQAssetView
*
)
self
.
contentView
.
subviews
[
i
]).
frame
=
CGRectMake
(
assetViewX
+
(
kThumbnailSize
.
width
+
minimumInteritemSpacing
)
*
(
i
),
minimumLineSpacing
-
1
,
kThumbnailSize
.
width
,
kThumbnailSize
.
height
);
[(
ZYQAssetView
*
)
self
.
contentView
.
subviews
[
i
]
bind
:
assets
[
i
]
selectionFilter
:
selectionFilter
isSeleced
:
[((
ZYQAssetViewController
*
)
_delegate
).
indexPathsForSelectedItems
containsObject
:
assets
[
i
]]];
}
}
}
else
{
for
(
int
i
=
self
.
contentView
.
subviews
.
count
;
i
>
0
;
i
--
)
{
if
(
i
>
assets
.
count
)
{
[((
ZYQAssetView
*
)
self
.
contentView
.
subviews
[
i
-
1
])
removeFromSuperview
];
}
else
{
((
ZYQAssetView
*
)
self
.
contentView
.
subviews
[
i
-
1
]).
frame
=
CGRectMake
(
assetViewX
+
(
kThumbnailSize
.
width
+
minimumInteritemSpacing
)
*
(
i
-
1
),
minimumLineSpacing
-
1
,
kThumbnailSize
.
width
,
kThumbnailSize
.
height
);
[(
ZYQAssetView
*
)
self
.
contentView
.
subviews
[
i
-
1
]
bind
:
assets
[
i
-
1
]
selectionFilter
:
selectionFilter
isSeleced
:
[((
ZYQAssetViewController
*
)
_delegate
).
indexPathsForSelectedItems
containsObject
:
assets
[
i
-
1
]]];
}
}
}
}
#pragma mark - ZYQAssetView Delegate
-
(
BOOL
)
shouldSelectAsset
:(
ALAsset
*
)
asset
{
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
shouldSelectAsset
:)])
{
return
[
_delegate
shouldSelectAsset
:
asset
];
}
return
YES
;
}
-
(
void
)
tapSelectHandle
:(
BOOL
)
select
asset
:(
ALAsset
*
)
asset
{
if
(
select
)
{
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
didSelectAsset
:)])
{
[
_delegate
didSelectAsset
:
asset
];
}
}
else
{
if
(
_delegate
!=
nil
&&
[
_delegate
respondsToSelector
:
@selector
(
didDeselectAsset
:)])
{
[
_delegate
didDeselectAsset
:
asset
];
}
}
}
@end
#pragma mark - ZYQAssetViewController
#import "HGPhWViewController.h"
@interface
ZYQAssetViewController
()
<
ZYQAssetViewCellDelegate
>
{
int
columns
;
float
minimumInteritemSpacing
;
float
minimumLineSpacing
;
BOOL
unFirst
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
assets
;
@property
(
nonatomic
,
assign
)
NSInteger
numberOfPhotos
;
@property
(
nonatomic
,
assign
)
NSInteger
numberOfVideos
;
@end
#define kAssetViewCellIdentifier @"AssetViewCellIdentifier"
@implementation
ZYQAssetViewController
-
(
id
)
init
{
#pragma 添加原始本地的imgAssets
// if ([[HGPhWViewController shareInstance] allImgAssets].count > 0) {
// _indexPathsForSelectedItems = [NSMutableArray arrayWithArray:[[HGPhWViewController shareInstance] allImgAssets]];
// } else {
// _indexPathsForSelectedItems=[[NSMutableArray alloc] init];
// }
_indexPathsForSelectedItems
=
[[
NSMutableArray
alloc
]
init
];
if
(
UIInterfaceOrientationIsLandscape
(
self
.
interfaceOrientation
))
{
self
.
tableView
.
contentInset
=
UIEdgeInsetsMake
(
9
.
0
,
2
.
0
,
0
,
2
.
0
);
minimumInteritemSpacing
=
3
;
minimumLineSpacing
=
3
;
}
else
{
self
.
tableView
.
contentInset
=
UIEdgeInsetsMake
(
9
.
0
,
0
,
0
,
0
);
minimumInteritemSpacing
=
2
;
minimumLineSpacing
=
2
;
}
if
(
self
=
[
super
init
])
{
if
([
self
respondsToSelector
:
@selector
(
setEdgesForExtendedLayout
:)])
[
self
setEdgesForExtendedLayout
:
UIRectEdgeNone
];
if
([
self
respondsToSelector
:
@selector
(
setContentSizeForViewInPopover
:)])
[
self
setContentSizeForViewInPopover
:
kPopoverContentSize
];
}
[
self
.
tableView
setSeparatorStyle
:
UITableViewCellSeparatorStyleNone
];
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
setupViews
];
[
self
setupButtons
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
if
(
!
unFirst
)
{
columns
=
floor
(
self
.
view
.
frame
.
size
.
width
/
(
kThumbnailSize
.
width
+
minimumInteritemSpacing
));
[
self
setupAssets
];
unFirst
=
YES
;
}
}
#pragma mark - Rotation
-
(
void
)
willAnimateRotationToInterfaceOrientation
:
(
UIInterfaceOrientation
)
toInterfaceOrientation
duration
:
(
NSTimeInterval
)
duration
{
if
(
UIInterfaceOrientationIsLandscape
(
toInterfaceOrientation
))
{
self
.
tableView
.
contentInset
=
UIEdgeInsetsMake
(
9
.
0
,
0
,
0
,
0
);
minimumInteritemSpacing
=
3
;
minimumLineSpacing
=
3
;
}
else
{
self
.
tableView
.
contentInset
=
UIEdgeInsetsMake
(
9
.
0
,
0
,
0
,
0
);
minimumInteritemSpacing
=
2
;
minimumLineSpacing
=
2
;
}
columns
=
floor
(
self
.
view
.
frame
.
size
.
width
/
(
kThumbnailSize
.
width
+
minimumInteritemSpacing
));
[
self
.
tableView
reloadData
];
}
#pragma mark - Setup
-
(
void
)
setupViews
{
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
}
-
(
void
)
setupButtons
{
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
NSLocalizedString
(
@"完成"
,
nil
)
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
finishPickingAssets
:
)];
}
-
(
void
)
setupAssets
{
self
.
title
=
[
self
.
assetsGroup
valueForProperty
:
ALAssetsGroupPropertyName
];
self
.
numberOfPhotos
=
0
;
self
.
numberOfVideos
=
0
;
if
(
!
self
.
assets
)
self
.
assets
=
[[
NSMutableArray
alloc
]
init
];
else
[
self
.
assets
removeAllObjects
];
ALAssetsGroupEnumerationResultsBlock
resultsBlock
=
^
(
ALAsset
*
asset
,
NSUInteger
index
,
BOOL
*
stop
)
{
if
(
asset
)
{
[
self
.
assets
addObject
:
asset
];
NSString
*
type
=
[
asset
valueForProperty
:
ALAssetPropertyType
];
if
([
type
isEqual
:
ALAssetTypePhoto
])
self
.
numberOfPhotos
++
;
if
([
type
isEqual
:
ALAssetTypeVideo
])
self
.
numberOfVideos
++
;
}
else
if
(
self
.
assets
.
count
>
0
)
{
[
self
.
tableView
reloadData
];
[
self
.
tableView
scrollToRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
ceil
(
self
.
assets
.
count
*
1
.
0
/
columns
)
inSection
:
0
]
atScrollPosition
:
UITableViewScrollPositionTop
animated
:
YES
];
}
};
[
self
.
assetsGroup
enumerateAssetsUsingBlock
:
resultsBlock
];
}
#pragma mark - UITableView DataSource
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
ceil
(
self
.
assets
.
count
*
1
.
0
/
columns
))
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"cellFooter"
];
if
(
cell
==
nil
)
{
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
@"cellFooter"
];
cell
.
textLabel
.
font
=
[
UIFont
systemFontOfSize
:
18
];
cell
.
textLabel
.
backgroundColor
=
[
UIColor
clearColor
];
cell
.
textLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cell
.
textLabel
.
textColor
=
[
UIColor
blackColor
];
cell
.
backgroundColor
=
[
UIColor
clearColor
];
[
cell
setSelectionStyle
:
UITableViewCellSelectionStyleNone
];
}
NSString
*
title
;
if
(
_numberOfVideos
==
0
)
title
=
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"%ld 张照片"
,
nil
),
(
long
)
_numberOfPhotos
];
else
if
(
_numberOfPhotos
==
0
)
title
=
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"%ld 部视频"
,
nil
),
(
long
)
_numberOfVideos
];
else
title
=
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"%ld 张照片, %ld 部视频"
,
nil
),
(
long
)
_numberOfPhotos
,
(
long
)
_numberOfVideos
];
cell
.
textLabel
.
text
=
title
;
return
cell
;
}
NSMutableArray
*
tempAssets
=
[[
NSMutableArray
alloc
]
init
];
for
(
int
i
=
0
;
i
<
columns
;
i
++
)
{
if
((
indexPath
.
row
*
columns
+
i
)
<
self
.
assets
.
count
)
{
[
tempAssets
addObject
:[
self
.
assets
objectAtIndex
:
indexPath
.
row
*
columns
+
i
]];
}
}
static
NSString
*
CellIdentifier
=
kAssetViewCellIdentifier
;
ZYQAssetPickerController
*
picker
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
ZYQAssetViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
if
(
cell
==
nil
)
{
cell
=
[[
ZYQAssetViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
CellIdentifier
];
}
cell
.
delegate
=
self
;
[
cell
bind
:
tempAssets
selectionFilter
:
picker
.
selectionFilter
minimumInteritemSpacing
:
minimumInteritemSpacing
minimumLineSpacing
:
minimumLineSpacing
columns
:
columns
assetViewX
:
(
self
.
tableView
.
frame
.
size
.
width
-
kThumbnailSize
.
width
*
tempAssets
.
count
-
minimumInteritemSpacing
*
(
tempAssets
.
count
-
1
))
/
2
];
return
cell
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
ceil
(
self
.
assets
.
count
*
1
.
0
/
columns
)
+
1
;
}
#pragma mark - UITableView Delegate
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
ceil
(
self
.
assets
.
count
*
1
.
0
/
columns
))
{
return
44
;
}
return
kThumbnailSize
.
height
+
minimumLineSpacing
;
}
#pragma mark - ZYQAssetViewCell Delegate
-
(
BOOL
)
shouldSelectAsset
:
(
ALAsset
*
)
asset
{
ZYQAssetPickerController
*
vc
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
BOOL
selectable
=
[
vc
.
selectionFilter
evaluateWithObject
:
asset
];
if
(
_indexPathsForSelectedItems
.
count
>
vc
.
maximumNumberOfSelection
)
{
if
(
vc
.
delegate
!=
nil
&&
[
vc
.
delegate
respondsToSelector
:
@selector
(
assetPickerControllerDidMaximum
:)])
{
[
vc
.
delegate
assetPickerControllerDidMaximum
:
vc
];
}
}
return
(
selectable
&&
_indexPathsForSelectedItems
.
count
<
vc
.
maximumNumberOfSelection
);
}
-
(
void
)
didSelectAsset
:
(
ALAsset
*
)
asset
{
[
_indexPathsForSelectedItems
addObject
:
asset
];
ZYQAssetPickerController
*
vc
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
vc
.
indexPathsForSelectedItems
=
_indexPathsForSelectedItems
;
if
(
vc
.
delegate
!=
nil
&&
[
vc
.
delegate
respondsToSelector
:
@selector
(
assetPickerController
:
didSelectAsset
:
)])
[
vc
.
delegate
assetPickerController
:
vc
didSelectAsset
:
asset
];
[
self
setTitleWithSelectedIndexPaths
:
_indexPathsForSelectedItems
];
}
-
(
void
)
didDeselectAsset
:
(
ALAsset
*
)
asset
{
[
_indexPathsForSelectedItems
removeObject
:
asset
];
ZYQAssetPickerController
*
vc
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
vc
.
indexPathsForSelectedItems
=
_indexPathsForSelectedItems
;
if
(
vc
.
delegate
!=
nil
&&
[
vc
.
delegate
respondsToSelector
:
@selector
(
assetPickerController
:
didDeselectAsset
:
)])
[
vc
.
delegate
assetPickerController
:
vc
didDeselectAsset
:
asset
];
[
self
setTitleWithSelectedIndexPaths
:
_indexPathsForSelectedItems
];
}
#pragma mark - Title
-
(
void
)
setTitleWithSelectedIndexPaths
:
(
NSArray
*
)
indexPaths
{
// Reset title to group name
if
(
indexPaths
.
count
==
0
)
{
self
.
title
=
[
self
.
assetsGroup
valueForProperty
:
ALAssetsGroupPropertyName
];
return
;
}
BOOL
photosSelected
=
NO
;
BOOL
videoSelected
=
NO
;
for
(
int
i
=
0
;
i
<
indexPaths
.
count
;
i
++
)
{
ALAsset
*
asset
=
indexPaths
[
i
];
if
([[
asset
valueForProperty
:
ALAssetPropertyType
]
isEqual
:
ALAssetTypePhoto
])
photosSelected
=
YES
;
if
([[
asset
valueForProperty
:
ALAssetPropertyType
]
isEqual
:
ALAssetTypeVideo
])
videoSelected
=
YES
;
if
(
photosSelected
&&
videoSelected
)
break
;
}
NSString
*
format
;
if
(
photosSelected
&&
videoSelected
)
format
=
NSLocalizedString
(
@"已选择 %ld 个项目"
,
nil
);
else
if
(
photosSelected
)
format
=
(
indexPaths
.
count
>
1
)
?
NSLocalizedString
(
@"已选择 %ld 张照片"
,
nil
)
:
NSLocalizedString
(
@"已选择 %ld 张照片 "
,
nil
);
else
if
(
videoSelected
)
format
=
(
indexPaths
.
count
>
1
)
?
NSLocalizedString
(
@"已选择 %ld 部视频"
,
nil
)
:
NSLocalizedString
(
@"已选择 %ld 部视频 "
,
nil
);
self
.
title
=
[
NSString
stringWithFormat
:
format
,
(
long
)
indexPaths
.
count
];
}
#pragma mark - Actions
-
(
void
)
finishPickingAssets
:
(
id
)
sender
{
ZYQAssetPickerController
*
picker
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
if
(
_indexPathsForSelectedItems
.
count
<
picker
.
minimumNumberOfSelection
)
{
if
(
picker
.
delegate
!=
nil
&&
[
picker
.
delegate
respondsToSelector
:
@selector
(
assetPickerControllerDidMaximum
:)])
{
[
picker
.
delegate
assetPickerControllerDidMaximum
:
picker
];
}
}
if
([
picker
.
delegate
respondsToSelector
:
@selector
(
assetPickerController
:
didFinishPickingAssets
:
)])
[
picker
.
delegate
assetPickerController
:
picker
didFinishPickingAssets
:
_indexPathsForSelectedItems
];
if
(
picker
.
isFinishDismissViewController
)
{
[
picker
.
presentingViewController
dismissViewControllerAnimated
:
YES
completion
:
NULL
];
}
}
@end
#pragma mark - ZYQAssetGroupViewCell
@interface
ZYQAssetGroupViewCell
()
@property
(
nonatomic
,
strong
)
ALAssetsGroup
*
assetsGroup
;
@end
@implementation
ZYQAssetGroupViewCell
-
(
void
)
bind
:(
ALAssetsGroup
*
)
assetsGroup
{
self
.
assetsGroup
=
assetsGroup
;
CGImageRef
posterImage
=
assetsGroup
.
posterImage
;
size_t
height
=
CGImageGetHeight
(
posterImage
);
float
scale
=
height
/
kThumbnailLength
;
self
.
imageView
.
image
=
[
UIImage
imageWithCGImage
:
posterImage
scale
:
scale
orientation
:
UIImageOrientationUp
];
self
.
textLabel
.
text
=
[
assetsGroup
valueForProperty
:
ALAssetsGroupPropertyName
];
self
.
detailTextLabel
.
text
=
[
NSString
stringWithFormat
:
@"%ld"
,
(
long
)[
assetsGroup
numberOfAssets
]];
self
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
}
-
(
NSString
*
)
accessibilityLabel
{
NSString
*
label
=
[
self
.
assetsGroup
valueForProperty
:
ALAssetsGroupPropertyName
];
return
[
label
stringByAppendingFormat
:
NSLocalizedString
(
@"%ld 张照片"
,
nil
),
(
long
)[
self
.
assetsGroup
numberOfAssets
]];
}
@end
#pragma mark - ZYQAssetGroupViewController
@interface
ZYQAssetGroupViewController
()
@property
(
nonatomic
,
strong
)
ALAssetsLibrary
*
assetsLibrary
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
groups
;
@end
@implementation
ZYQAssetGroupViewController
-
(
id
)
init
{
if
(
self
=
[
super
initWithStyle
:
UITableViewStylePlain
])
{
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0
self
.
preferredContentSize
=
kPopoverContentSize
;
#else
if
([
self
respondsToSelector
:
@selector
(
setContentSizeForViewInPopover
:)])
[
self
setContentSizeForViewInPopover
:
kPopoverContentSize
];
#endif
}
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
setupViews
];
[
self
setupButtons
];
[
self
localize
];
[
self
setupGroup
];
}
#pragma mark - Rotation
-
(
BOOL
)
shouldAutorotate
{
return
YES
;
}
-
(
NSUInteger
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskAllButUpsideDown
;
}
#pragma mark - Setup
-
(
void
)
setupViews
{
self
.
tableView
.
rowHeight
=
kThumbnailLength
+
12
;
self
.
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
}
-
(
void
)
setupButtons
{
ZYQAssetPickerController
*
picker
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
if
(
picker
.
showCancelButton
)
{
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
NSLocalizedString
(
@"取消"
,
nil
)
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
dismiss
:
)];
}
}
-
(
void
)
localize
{
self
.
title
=
NSLocalizedString
(
@"相簿"
,
nil
);
}
-
(
void
)
setupGroup
{
if
(
!
self
.
assetsLibrary
)
self
.
assetsLibrary
=
[
self
.
class
defaultAssetsLibrary
];
if
(
!
self
.
groups
)
self
.
groups
=
[[
NSMutableArray
alloc
]
init
];
else
[
self
.
groups
removeAllObjects
];
ZYQAssetPickerController
*
picker
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
ALAssetsFilter
*
assetsFilter
=
picker
.
assetsFilter
;
ALAssetsLibraryGroupsEnumerationResultsBlock
resultsBlock
=
^
(
ALAssetsGroup
*
group
,
BOOL
*
stop
)
{
if
(
group
)
{
[
group
setAssetsFilter
:
assetsFilter
];
if
(
group
.
numberOfAssets
>
0
||
picker
.
showEmptyGroups
)
[
self
.
groups
addObject
:
group
];
}
else
{
[
self
reloadData
];
}
};
ALAssetsLibraryAccessFailureBlock
failureBlock
=
^
(
NSError
*
error
)
{
[
self
showNotAllowed
];
};
// Enumerate Camera roll first
[
self
.
assetsLibrary
enumerateGroupsWithTypes
:
ALAssetsGroupSavedPhotos
usingBlock
:
resultsBlock
failureBlock
:
failureBlock
];
// Then all other groups
NSUInteger
type
=
ALAssetsGroupLibrary
|
ALAssetsGroupAlbum
|
ALAssetsGroupEvent
|
ALAssetsGroupFaces
|
ALAssetsGroupPhotoStream
;
[
self
.
assetsLibrary
enumerateGroupsWithTypes
:
type
usingBlock
:
resultsBlock
failureBlock
:
failureBlock
];
}
#pragma mark - Reload Data
-
(
void
)
reloadData
{
if
(
self
.
groups
.
count
==
0
)
[
self
showNoAssets
];
[
self
.
tableView
reloadData
];
}
#pragma mark - ALAssetsLibrary
+
(
ALAssetsLibrary
*
)
defaultAssetsLibrary
{
static
dispatch_once_t
pred
=
0
;
static
ALAssetsLibrary
*
library
=
nil
;
dispatch_once
(
&
pred
,
^
{
library
=
[[
ALAssetsLibrary
alloc
]
init
];
});
return
library
;
}
#pragma mark - Not allowed / No assets
-
(
void
)
showNotAllowed
{
if
([
self
respondsToSelector
:
@selector
(
setEdgesForExtendedLayout
:)])
[
self
setEdgesForExtendedLayout
:
UIRectEdgeLeft
|
UIRectEdgeRight
|
UIRectEdgeBottom
];
self
.
title
=
nil
;
UIImageView
*
padlock
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageWithContentsOfFile
:[[[
NSBundle
mainBundle
]
resourcePath
]
stringByAppendingPathComponent
:
@"ZYQAssetPicker.Bundle/Images/AssetsPickerLocked@2x.png"
]]];
padlock
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
UILabel
*
title
=
[
UILabel
new
];
title
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
title
.
preferredMaxLayoutWidth
=
304
.
0
f
;
UILabel
*
message
=
[
UILabel
new
];
message
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
message
.
preferredMaxLayoutWidth
=
304
.
0
f
;
title
.
text
=
NSLocalizedString
(
@"此应用无法使用您的照片或视频。"
,
nil
);
title
.
font
=
[
UIFont
boldSystemFontOfSize
:
17
.
0
];
title
.
textColor
=
[
UIColor
colorWithRed
:
129
.
0
/
255
.
0
green
:
136
.
0
/
255
.
0
blue
:
148
.
0
/
255
.
0
alpha
:
1
];
title
.
textAlignment
=
NSTextAlignmentCenter
;
title
.
numberOfLines
=
5
;
message
.
text
=
NSLocalizedString
(
@"你可以在「隐私设置」中启用存取。"
,
nil
);
message
.
font
=
[
UIFont
systemFontOfSize
:
14
.
0
];
message
.
textColor
=
[
UIColor
colorWithRed
:
129
.
0
/
255
.
0
green
:
136
.
0
/
255
.
0
blue
:
148
.
0
/
255
.
0
alpha
:
1
];
message
.
textAlignment
=
NSTextAlignmentCenter
;
message
.
numberOfLines
=
5
;
[
title
sizeToFit
];
[
message
sizeToFit
];
UIView
*
centerView
=
[
UIView
new
];
centerView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
centerView
addSubview
:
padlock
];
[
centerView
addSubview
:
title
];
[
centerView
addSubview
:
message
];
NSDictionary
*
viewsDictionary
=
NSDictionaryOfVariableBindings
(
padlock
,
title
,
message
);
[
centerView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
padlock
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
centerView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
centerView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
title
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
padlock
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
centerView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
message
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
padlock
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
centerView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[padlock]-[title]-[message]|"
options
:
0
metrics
:
nil
views
:
viewsDictionary
]];
UIView
*
backgroundView
=
[
UIView
new
];
[
backgroundView
addSubview
:
centerView
];
[
backgroundView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
centerView
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
backgroundView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
backgroundView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
centerView
attribute
:
NSLayoutAttributeCenterY
relatedBy
:
NSLayoutRelationEqual
toItem
:
backgroundView
attribute
:
NSLayoutAttributeCenterY
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
self
.
tableView
.
backgroundView
=
backgroundView
;
}
-
(
void
)
showNoAssets
{
if
([
self
respondsToSelector
:
@selector
(
setEdgesForExtendedLayout
:)])
[
self
setEdgesForExtendedLayout
:
UIRectEdgeLeft
|
UIRectEdgeRight
|
UIRectEdgeBottom
];
UILabel
*
title
=
[
UILabel
new
];
title
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
title
.
preferredMaxLayoutWidth
=
304
.
0
f
;
UILabel
*
message
=
[
UILabel
new
];
message
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
message
.
preferredMaxLayoutWidth
=
304
.
0
f
;
title
.
text
=
NSLocalizedString
(
@"没有照片或视频。"
,
nil
);
title
.
font
=
[
UIFont
systemFontOfSize
:
26
.
0
];
title
.
textColor
=
[
UIColor
colorWithRed
:
153
.
0
/
255
.
0
green
:
153
.
0
/
255
.
0
blue
:
153
.
0
/
255
.
0
alpha
:
1
];
title
.
textAlignment
=
NSTextAlignmentCenter
;
title
.
numberOfLines
=
5
;
message
.
text
=
NSLocalizedString
(
@"您可以使用 iTunes 将照片和视频
\n
同步到 iPhone。"
,
nil
);
message
.
font
=
[
UIFont
systemFontOfSize
:
18
.
0
];
message
.
textColor
=
[
UIColor
colorWithRed
:
153
.
0
/
255
.
0
green
:
153
.
0
/
255
.
0
blue
:
153
.
0
/
255
.
0
alpha
:
1
];
message
.
textAlignment
=
NSTextAlignmentCenter
;
message
.
numberOfLines
=
5
;
[
title
sizeToFit
];
[
message
sizeToFit
];
UIView
*
centerView
=
[
UIView
new
];
centerView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
centerView
addSubview
:
title
];
[
centerView
addSubview
:
message
];
NSDictionary
*
viewsDictionary
=
NSDictionaryOfVariableBindings
(
title
,
message
);
[
centerView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
title
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
centerView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
centerView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
message
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
title
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
centerView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[title]-[message]|"
options
:
0
metrics
:
nil
views
:
viewsDictionary
]];
UIView
*
backgroundView
=
[
UIView
new
];
[
backgroundView
addSubview
:
centerView
];
[
backgroundView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
centerView
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
backgroundView
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
[
backgroundView
addConstraint
:[
NSLayoutConstraint
constraintWithItem
:
centerView
attribute
:
NSLayoutAttributeCenterY
relatedBy
:
NSLayoutRelationEqual
toItem
:
backgroundView
attribute
:
NSLayoutAttributeCenterY
multiplier
:
1
.
0
f
constant
:
0
.
0
f
]];
self
.
tableView
.
backgroundView
=
backgroundView
;
}
#pragma mark - Table view data source
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
groups
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
CellIdentifier
=
@"Cell"
;
ZYQAssetGroupViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
if
(
cell
==
nil
)
{
cell
=
[[
ZYQAssetGroupViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleSubtitle
reuseIdentifier
:
CellIdentifier
];
}
[
cell
bind
:[
self
.
groups
objectAtIndex
:
indexPath
.
row
]];
return
cell
;
}
#pragma mark - UITableView Delegate
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
kThumbnailLength
+
12
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
ZYQAssetViewController
*
vc
=
[[
ZYQAssetViewController
alloc
]
init
];
vc
.
assetsGroup
=
[
self
.
groups
objectAtIndex
:
indexPath
.
row
];
[
self
.
navigationController
pushViewController
:
vc
animated
:
YES
];
}
#pragma mark - Actions
-
(
void
)
dismiss
:
(
id
)
sender
{
ZYQAssetPickerController
*
picker
=
(
ZYQAssetPickerController
*
)
self
.
navigationController
;
if
([
picker
.
delegate
respondsToSelector
:
@selector
(
assetPickerControllerDidCancel
:)])
[
picker
.
delegate
assetPickerControllerDidCancel
:
picker
];
[
picker
.
presentingViewController
dismissViewControllerAnimated
:
YES
completion
:
NULL
];
}
@end
#pragma mark - ZYQAssetPickerController
@implementation
ZYQAssetPickerController
-
(
id
)
init
{
ZYQAssetGroupViewController
*
groupViewController
=
[[
ZYQAssetGroupViewController
alloc
]
init
];
if
(
self
=
[
super
initWithRootViewController
:
groupViewController
])
{
_maximumNumberOfSelection
=
10
;
_minimumNumberOfSelection
=
0
;
_assetsFilter
=
[
ALAssetsFilter
allAssets
];
_showCancelButton
=
YES
;
_showEmptyGroups
=
NO
;
_selectionFilter
=
[
NSPredicate
predicateWithValue
:
YES
];
_isFinishDismissViewController
=
YES
;
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0
self
.
preferredContentSize
=
kPopoverContentSize
;
#else
if
([
self
respondsToSelector
:
@selector
(
setContentSizeForViewInPopover
:)])
[
self
setContentSizeForViewInPopover
:
kPopoverContentSize
];
#endif
}
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
}
@end
XFFruit/ViewControllers/SurveyFeedbackListViewController.h
0 → 100644
View file @
02b8c8df
//
// FeedBackViewController.h
// XFFruit
// 行情反馈需要的行情单列表
// Created by freecui on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface
SurveyFeedbackListViewController
:
ICRBaseViewController
@end
XFFruit/ViewControllers/SurveyFeedbackListViewController.m
0 → 100644
View file @
02b8c8df
//
// SurveyViewController.m
// XFFurit
// 行情反馈需要的行情单列表
// Created by 陈俊俊 on 15/8/1.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "SurveyFeedbackListViewController.h"
#import "SurveyListCell.h"
#import "Survey.h"
#import "SortMaskView.h"
#import "BoltMaskView.h"
#import "WriteFeedbackViewController.h"
//#import "SurveyDetailViewController.h"
//#import "NewSurveyViewController.h"
#import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#import "QueryOrder.h"
#import "WriteFeedbackViewController.h"
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
#define BtnWidth 60
#define BtnHeight 24
#define BtnSize 16
typedef
enum
:
NSUInteger
{
SortTag
=
3000
,
BoltTag
}
BtnTag
;
@interface
SurveyFeedbackListViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
BoltMaskViewDelegate
,
SortMaskViewDelegate
>
{
UIView
*
_maskView
;
UIButton
*
currentBtn
;
SortMaskView
*
_sortView
;
BoltMaskView
*
_boltView
;
UIBarButtonItem
*
_sureBtn
;
UIButton
*
_sortBtn
;
UIButton
*
_boltBtn
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSString
*
billNumberLike
;
@property
(
nonatomic
,
strong
)
NSString
*
state
;
//未提交=initial已提交=submitted调研中=insurvey已完成=finished
@property
(
nonatomic
,
strong
)
NSString
*
titleLike
;
@property
(
nonatomic
,
strong
)
NSString
*
orderField
;
@property
(
nonatomic
,
strong
)
NSString
*
orderDirection
;
//asc(升序),desc(降序)
@end
@implementation
SurveyFeedbackListViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"行情调研(调研中)"
;
self
.
view
.
backgroundColor
=
XXFBgColor
;
[
self
initData
];
[
self
createTableView
];
[
self
getData
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
if
([
ICRUserUtil
sharedInstance
].
needFresh
)
{
[
self
getData
];
}
}
-
(
void
)
getData
{
[
ICRUserUtil
sharedInstance
].
needFresh
=
NO
;
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchtSurveyList
:
data
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
id
orderFieldObject
=
[
NSNull
null
];
NSMutableArray
*
orderArr
=
[
NSMutableArray
array
];
if
(
self
.
orderDirection
.
length
>
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"lastModified"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
id
billObject
=
[
NSNull
null
];
if
(
self
.
billNumberLike
.
length
>
0
)
{
billObject
=
self
.
billNumberLike
;
if
(
self
.
orderDirection
.
length
>
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"billNumber"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
id
stateObject
=
[
NSNull
null
];
if
(
self
.
state
.
length
>
0
&&
!
[
self
.
state
isEqualToString
:
@"none"
])
{
stateObject
=
self
.
state
;
if
(
self
.
orderDirection
.
length
>
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"state"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
id
titleObject
=
[
NSNull
null
];
if
(
self
.
titleLike
.
length
>
0
)
{
titleObject
=
self
.
titleLike
;
if
(
self
.
orderDirection
.
length
>
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"title"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
NSDictionary
*
dict
=
@{
@"billNumberLike"
:
billObject
,
@"state"
:
stateObject
,
@"titleLike"
:
titleObject
,
@"queryOrders"
:
orderArr
,
@"userUuid"
:
userUtil
.
userId
,
@"pageNumber"
:
@
(
0
),
@"pageSize"
:
@
(
100
)};
[[
ICRHTTPController
sharedController
]
querySurveyWithBillData
:
dict
success
:
succ
failure
:
fail
];
}
#pragma mark -成功
-
(
void
)
fetchtSurveyList
:
(
id
)
data
{
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
if
(
self
.
dataArr
.
count
>
0
)
{
[
self
.
dataArr
removeAllObjects
];
}
NSArray
*
recodesArr
=
data
[
@"data"
][
@"records"
];
for
(
NSDictionary
*
surveyDict
in
recodesArr
)
{
Survey
*
survey
=
[[
Survey
alloc
]
init
];
[
survey
setValuesForKeysWithDictionary
:
surveyDict
];
[
self
.
dataArr
addObject
:
survey
];
}
[
self
.
tableView
reloadData
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@" 无记录 "
];
}
}
-
(
void
)
createTableView
{
_sureBtn
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
_sortBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
10
,
BtnWidth
,
BtnHeight
)
target
:
self
sel
:
@selector
(
sortClick
:
)
tag
:
SortTag
image
:
@"black_arrow_down_with_text"
title
:
nil
titleColor
:
HexColor
(
@"888888"
)
isCorner
:
NO
corner
:
0
bgColor
:
nil
];
_sortBtn
.
titleLabel
.
font
=
FontSize
(
BtnSize
);
[
self
.
view
addSubview
:
_sortBtn
];
_boltBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
ScreenSize
.
width
-
BtnWidth
-
LeftMargin
,
10
,
BtnWidth
,
BtnHeight
)
target
:
self
sel
:
@selector
(
sortClick
:
)
tag
:
BoltTag
image
:
@"black_filter_with_text"
title
:
nil
titleColor
:
HexColor
(
@"888888"
)
isCorner
:
NO
corner
:
0
bgColor
:
nil
];
_boltBtn
.
titleLabel
.
font
=
FontSize
(
BtnSize
);
[
self
.
view
addSubview
:
_boltBtn
];
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
_maskView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
)];
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
_maskView
.
hidden
=
YES
;
[
self
.
view
addSubview
:
_maskView
];
}
#pragma mark - 确定
-
(
void
)
sureClick
{
[
_boltView
.
titleFiled
resignFirstResponder
];
[
_boltView
.
billFiled
resignFirstResponder
];
//请求
[
self
getData
];
//还原数据
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
YES
];
}
if
(
_boltView
)
{
[
self
hiddenBoltMaskView
:
YES
];
}
//清空所有条件
if
(
self
.
orderDirection
.
length
>
0
)
{
self
.
orderDirection
=
@""
;
}
if
(
self
.
billNumberLike
.
length
>
0
)
{
self
.
billNumberLike
=
@""
;
}
if
(
self
.
titleLike
.
length
>
0
)
{
self
.
titleLike
=
@""
;
}
if
(
self
.
state
.
length
>
0
)
{
self
.
state
=
@""
;
}
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
#pragma mark -按钮事件
-
(
void
)
sortClick
:
(
UIButton
*
)
btn
{
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
_maskView
.
hidden
=
NO
;
if
(
btn
.
tag
==
SortTag
)
{
if
(
_boltView
){
[
self
hiddenBoltMaskView
:
NO
];
}
if
(
currentBtn
==
btn
)
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenSortMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
105
)
withOrderDirection
:
self
.
orderDirection
];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"按时间顺序"
,
@"按时间逆序"
,
nil
];
_sortView
.
delegate
=
self
;
[
_maskView
addSubview
:
_sortView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_sortView
.
frame
;
sortFrame
.
origin
.
y
=
0
;
_sortView
.
frame
=
sortFrame
;
}];
}
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
currentBtn
=
btn
;
}
}
else
if
(
btn
.
tag
==
BoltTag
){
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
NO
];
}
if
(
currentBtn
==
btn
)
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenBoltMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
if
(
_boltView
==
nil
)
{
_boltView
=
[[
BoltMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
224
)
state
:
self
.
state
title
:
self
.
titleLike
bill
:
self
.
billNumberLike
];
_boltView
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_boltView
.
delegate
=
self
;
_boltView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"不限"
,
@"未提交"
,
@"已提交"
,
@"调研中"
,
nil
];
[
_maskView
addSubview
:
_boltView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_boltView
.
frame
;
sortFrame
.
origin
.
y
=
0
;
_boltView
.
frame
=
sortFrame
;
}];
currentBtn
=
btn
;
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
}
}
}
}
-
(
void
)
hiddenSortMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
if
(
isHide
==
NO
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
}
else
{
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_sortView
.
frame
;
sortFrame
.
origin
.
y
=
-
105
;
_sortView
.
frame
=
sortFrame
;
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
);
}
completion
:^
(
BOOL
finished
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
_maskView
.
hidden
=
YES
;
}];
}
}
-
(
void
)
hiddenBoltMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
if
(
isHide
==
NO
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
}
else
{
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
CGRect
sortFrame
=
_boltView
.
frame
;
sortFrame
.
origin
.
y
=
-
105
;
_boltView
.
frame
=
sortFrame
;
_maskView
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
);
}
completion
:^
(
BOOL
finished
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
_maskView
.
hidden
=
YES
;
}];
}
}
#pragma mark - sortDelegate
-
(
void
)
getSortValueSelectRow
:
(
NSString
*
)
state
{
self
.
orderDirection
=
state
;
NSLog
(
@"%@"
,
state
);
}
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
{
self
.
state
=
state
;
NSLog
(
@"%@"
,
state
);
}
-
(
void
)
getTitleLike
:
(
NSString
*
)
titleLike
{
self
.
titleLike
=
titleLike
;
NSLog
(
@"%@"
,
titleLike
);
}
-
(
void
)
getBillNumber
:
(
NSString
*
)
billNumber
{
self
.
billNumberLike
=
billNumber
;
NSLog
(
@"%@"
,
billNumber
);
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"SurveyID"
;
SurveyListCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
cell
==
nil
)
{
cell
=
[[
SurveyListCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
}
if
(
self
.
dataArr
.
count
>
0
)
{
Survey
*
survey
=
self
.
dataArr
[
indexPath
.
row
];
[
cell
setSurvey
:
survey
];
}
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
// Survey *survey = nil;
// if (self.dataArr.count > 0) {
// survey = self.dataArr[indexPath.row];
// }
// if ([survey.state isEqualToString:@"initial"]) {
// NewSurveyViewController *nvc = [[NewSurveyViewController alloc]init];
// nvc.survey = survey;
// nvc.navTitle = @"修改行情调研单";
// [self PushViewController:nvc animated:YES];
//
// }else if([survey.state isEqualToString:@"submitted"] || [survey.state isEqualToString:@"insurvey"]|| [survey.state isEqualToString:@"finished"]){
// SurveyDetailViewController *svc = [SurveyDetailViewController new];
// svc.survey = survey;
// svc.surveyUuid = survey.uuid;
// [self PushViewController:svc animated:YES];
// }
Survey
*
survey
=
self
.
dataArr
[
indexPath
.
row
];
WriteFeedbackViewController
*
writeFbVC
=
[[
WriteFeedbackViewController
alloc
]
initWithImgName
:
@"LoginBG"
];
writeFbVC
.
survey
=
survey
;
writeFbVC
.
surveyUuid
=
survey
.
uuid
;
[
self
PushViewController
:
writeFbVC
animated
:
YES
];
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
XFFruit/ViewControllers/WriteFeedbackViewController.h
0 → 100644
View file @
02b8c8df
//
// WriteFeedbackViewController.h
// XFFruit
// 填写行情反馈
// Created by freecui on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@class
Survey
;
@interface
WriteFeedbackViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
Survey
*
survey
;
@property
(
nonatomic
,
strong
)
NSString
*
surveyUuid
;
@property
(
nonatomic
,
strong
)
NSArray
*
imgsFile
;
-
(
instancetype
)
initWithImgName
:(
NSString
*
)
imgName
;
@end
XFFruit/ViewControllers/WriteFeedbackViewController.m
0 → 100644
View file @
02b8c8df
//
// WriteFeedbackViewController.m
// XFFruit
// 填写行情反馈
// Created by freecui on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "WriteFeedbackViewController.h"
#import "HGPhWViewController.h"
#import "ZYQAssetPickerController.h"
#import "IBTImagePicker.h"
#import "SurveyResult.h"
#import "XFDB.h"
#import "XFPhoto.h"
@interface
WriteFeedbackViewController
()
<
ZYQAssetPickerControllerDelegate
,
UINavigationControllerDelegate
,
UIScrollViewDelegate
,
UIActionSheetDelegate
,
UIImagePickerControllerDelegate
>
#define IBT_DEFAULT_CELL_HEIGHT (44.0f)
#define BTN_PADDING 20
#define BOTTOM_BTN_WIDTH self.view.width - BTN_PADDING*2 //只有一个按钮时的长度
#define BTN_HEIGHT 40
@property
(
strong
,
nonatomic
)
IBTTableViewInfo
*
tableViewInfo
;
@property
(
strong
,
nonatomic
)
NSString
*
imgName
;
@property
(
strong
,
nonatomic
)
HGPhWViewController
*
hgPhVC
;
@property
(
strong
,
nonatomic
)
IBTImagePicker
*
m_imagePicker
;
@property
(
strong
,
nonatomic
)
UIActionSheet
*
m_actionSheet
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
imgesMuArr
;
@property
(
strong
,
nonatomic
)
SurveyResult
*
surveyResult
;
//@property (strong, nonatomic) NSDictionary *surveyResultDict;
//@property (strong, nonatomic) HGPhWViewController *hgphVC;
typedef
NS_ENUM
(
NSUInteger
,
feedbackCellInfo
){
kfeedbackCellPlace
=
0
,
kfeedbackCellPrice
,
kfeedbackCellCapacity
,
kfeedbackCellQulity
};
@end
@implementation
WriteFeedbackViewController
-
(
instancetype
)
initWithImgName
:(
NSString
*
)
imgName
{
self
=
[
super
init
];
if
(
!
self
)
{
return
nil
;
}
self
.
imgName
=
imgName
;
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
self
.
title
=
@"填写行情反馈"
;
[
self
initData
];
[
self
initSubviews
];
}
-
(
void
)
viewDidAppear
:
(
BOOL
)
animated
{
if
(
_hgPhVC
)
{
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
imgFiles
:
)
name
:
kimgsFiles
object
:
_hgPhVC
];
}
else
{
return
;
}
}
-
(
void
)
imgFiles
:
(
NSNotification
*
)
notification
{
//HGPhWViewController *h
}
-
(
void
)
initData
{
self
.
imgesMuArr
=
[
NSMutableArray
array
];
ICRUserUtil
*
user
=
[
ICRUserUtil
sharedInstance
];
// self.surveyResultDict = @{@"userUuid":user.userId,@"userCode":@"",@"userName":@"",@"price":[NSNull null],@"unit":[NSNull null],@"place":[NSNull null],@"capacity":[NSNull null],@"quality":[NSNull null]};
void
(
^
succ
)(
id
)
=
^
(
id
data
){
};
void
(
^
fail
)(
id
)
=
^
(
id
data
){
};
[[
ICRHTTPController
sharedController
]
getResultsWithUuid
:
_surveyUuid
success
:
succ
failure
:
fail
];
self
.
surveyResult
=
[[
SurveyResult
alloc
]
init
];
self
.
surveyResult
.
unit
=
@"南汇8424西瓜调研情况"
;
self
.
surveyResult
.
place
=
@"150605000001"
;
self
.
surveyResult
.
price
=
@"南汇842[100213]"
;
self
.
surveyResult
.
capacity
=
@"22222222222"
;
self
.
surveyResult
.
quality
=
@"费卡接口"
;
self
.
surveyResult
.
userName
=
@"张三"
;
self
.
surveyResult
.
feedbackTime
=
@"2015-04-05 12:04:06"
;
}
-
(
void
)
initSubviews
{
[
self
buildPhoto
];
[
self
buildContent
];
[
self
buildBottomButton
];
}
-
(
void
)
buildPhoto
{
UIView
*
backView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
width
,
self
.
view
.
height
*
0
.
4
)];
backView
.
backgroundColor
=
HexColor
(
@"7ebf74"
);
//ICR_TABBAR_TINT_COLOR;
[
self
.
view
addSubview
:
backView
];
UIImageView
*
imgV
=
[[
UIImageView
alloc
]
init
];
imgV
.
userInteractionEnabled
=
YES
;
//[img originImage:img scaleToSize:CGSizeMake(50,50)];//(imgV.width / 2.0, imgV.height / 2.0)];
UITapGestureRecognizer
*
tpGes
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
selectPhotos
:
)];
tpGes
.
numberOfTapsRequired
=
1
;
[
imgV
addGestureRecognizer
:
tpGes
];
[
backView
addSubview
:
imgV
];
NSArray
*
photosArr
=
[[
XFDB
sharedInstance
]
fetchAllPhotosFromLocal
];
if
(
photosArr
.
count
>
0
)
{
imgV
.
frame
=
backView
.
frame
;
XFPhoto
*
xfphonto
=
(
XFPhoto
*
)
photosArr
[
0
];
// NSData *da = xfphonto.photoData;
imgV
.
image
=
[
UIImage
imageWithData
:
xfphonto
.
photoData
];
UIImage
*
img
=
[
UIImage
imageWithData
:
xfphonto
.
photoData
];
UIButton
*
btn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
btn
.
frame
=
(
CGRect
){
.
origin
.
x
=
imgV
.
width
*
0
.
2
,
.
origin
.
y
=
imgV
.
height
*
0
.
8
,
.
size
.
width
=
24
,
.
size
.
height
=
24
};
[
btn
setBackgroundImage
:[
UIImage
imageNamed
:
@"xf_camera_add_pic"
]
forState
:
UIControlStateNormal
];
[
imgV
addSubview
:
btn
];
UIButton
*
delbtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
delbtn
.
frame
=
(
CGRect
){
.
origin
.
x
=
imgV
.
width
*
0
.
8
,
.
origin
.
y
=
imgV
.
height
*
0
.
8
,
.
size
.
width
=
24
,
.
size
.
height
=
24
};
[
delbtn
addTarget
:
self
action
:
@selector
(
photosDisplay
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
delbtn
setBackgroundImage
:[
UIImage
imageNamed
:
@"xf_delete_pic"
]
forState
:
UIControlStateNormal
];
[
imgV
addSubview
:
delbtn
];
}
else
{
imgV
.
frame
=
(
CGRect
){
.
origin
.
x
=
backView
.
width
/
4
.
0
,
.
origin
.
y
=
backView
.
height
/
4
.
0
,
.
size
.
width
=
backView
.
width
/
2
.
0
,
.
size
.
height
=
backView
.
height
/
2
.
0
};
UIImage
*
img
=
[
UIImage
imageNamed
:
@"xf_camera_no_pic"
];
imgV
.
image
=
img
;
}
}
-
(
void
)
buildContent
{
self
.
tableViewInfo
=
[[
IBTTableViewInfo
alloc
]
initWithFrame
:
CGRectMake
(
10
,
self
.
view
.
height
*
0
.
4
,
self
.
view
.
width
-
20
,
IBT_DEFAULT_CELL_HEIGHT
*
6
)
style
:
UITableViewStylePlain
];
IBTTableViewSectionInfo
*
secInfo
;
IBTTableViewCellInfo
*
cellInfo
;
UIColor
*
titleColor
=
[
UIColor
colorWithW
:
145
a
:
1
];
CGFloat
fCellHeight
=
IBT_DEFAULT_CELL_HEIGHT
;
secInfo
=
[
IBTTableViewSectionInfo
sectionInfoDefaut
];
//产地
cellInfo
=
[
IBTTableViewCellInfo
editorCellForSel
:
nil
target
:
nil
title
:
@"产地:"
margin
:
0
tip
:
nil
autoCorrect
:
NO
focus
:
NO
text
:
_surveyResult
.
place
];
[
cellInfo
addUserInfoValue
:
titleColor
forKey
:
CInfoTitleColorKey
];
cellInfo
.
fCellHeight
=
fCellHeight
;
[
secInfo
addCell
:
cellInfo
];
//价格
cellInfo
=
[
IBTTableViewCellInfo
editorCellForSel
:
nil
target
:
nil
title
:
@"价格:"
margin
:
0
tip
:
nil
autoCorrect
:
NO
focus
:
NO
text
:
_surveyResult
.
price
];
[
cellInfo
addUserInfoValue
:
titleColor
forKey
:
CInfoTitleColorKey
];
cellInfo
.
fCellHeight
=
fCellHeight
;
[
secInfo
addCell
:
cellInfo
];
//市场容量
cellInfo
=
[
IBTTableViewCellInfo
editorCellForSel
:
nil
target
:
nil
title
:
@"市场容量:"
margin
:
0
tip
:
nil
autoCorrect
:
NO
focus
:
NO
text
:
_surveyResult
.
capacity
];
[
cellInfo
addUserInfoValue
:
titleColor
forKey
:
CInfoTitleColorKey
];
cellInfo
.
fCellHeight
=
fCellHeight
;
[
secInfo
addCell
:
cellInfo
];
//质量情况
cellInfo
=
[
IBTTableViewCellInfo
editorCellForSel
:
nil
target
:
nil
title
:
@"质量情况:"
margin
:
0
tip
:
nil
autoCorrect
:
NO
focus
:
NO
text
:
_surveyResult
.
quality
];
[
cellInfo
addUserInfoValue
:
titleColor
forKey
:
CInfoTitleColorKey
];
cellInfo
.
fCellHeight
=
fCellHeight
;
[
secInfo
addCell
:
cellInfo
];
[
self
.
tableViewInfo
addSection
:
secInfo
];
IBTTableView
*
tableView
=
[
_tableViewInfo
getTableView
];
[
self
.
view
addSubview
:
tableView
];
}
-
(
IBTImagePicker
*
)
imagePicker
{
if
(
!
_m_imagePicker
)
{
self
.
m_imagePicker
=
[[
IBTImagePicker
alloc
]
init
];
}
return
_m_imagePicker
;
}
#pragma mark - UIActionSheetDelegate
-
(
void
)
actionSheet
:
(
UIActionSheet
*
)
actionSheet
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
switch
(
buttonIndex
)
{
case
0
:
[
self
openCamera
];
break
;
case
1
:
[
self
libraryPhoto
];
break
;
default
:
break
;
}
}
-
(
void
)
openCamera
{
UIImagePickerControllerSourceType
sourceType
=
UIImagePickerControllerSourceTypeCamera
;
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
picker
.
delegate
=
self
;
picker
.
allowsEditing
=
NO
;
picker
.
sourceType
=
sourceType
;
[
self
PresentModalViewController
:
picker
animated
:
YES
];
}
-
(
void
)
libraryPhoto
{
// UIImagePickerController *picker = [[UIImagePickerController alloc]init];
// picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary
// ;
// picker.delegate = self;
// picker.allowsEditing = NO;
// [self PresentModalViewController:picker animated:YES];
ZYQAssetPickerController
*
assetPicker
=
[[
ZYQAssetPickerController
alloc
]
init
];
assetPicker
.
maximumNumberOfSelection
=
10
;
assetPicker
.
assetsFilter
=
[
ALAssetsFilter
allPhotos
];
assetPicker
.
showEmptyGroups
=
NO
;
assetPicker
.
delegate
=
self
;
assetPicker
.
selectionFilter
=
[
NSPredicate
predicateWithBlock
:
^
BOOL
(
id
evaluatedObject
,
NSDictionary
*
bindings
)
{
if
([[(
ALAsset
*
)
evaluatedObject
valueForProperty
:
ALAssetPropertyType
]
isEqual
:
ALAssetTypeVideo
])
{
NSTimeInterval
duration
=
[[(
ALAsset
*
)
evaluatedObject
valueForProperty
:
ALAssetPropertyDuration
]
doubleValue
];
return
duration
>=
5
;
}
else
{
return
YES
;
}
}];
[
self
PresentModalViewController
:
assetPicker
animated
:
YES
];
}
#pragma mark - UIImagePickerControllerDelegate
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
// NSURL *imgUrl = [info objectForKey:UIImagePickerControllerReferenceURL];
UIImage
*
img
=
[
info
objectForKey
:
UIImagePickerControllerOriginalImage
];
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
// HGPhWViewController *hgPhVc = [[HGPhWViewController alloc]init];
// hgPhVc.img = img;
NSData
*
imgData
=
UIImagePNGRepresentation
(
img
);
[
self
savePhotoToDB
:
imgData
];
[
self
PushViewController
:[
HGPhWViewController
shareInstance
]
animated
:
YES
];
// hgPhVc.url = [NSString stringWithContentsOfURL:imgUrl encoding:NSUTF8StringEncoding error:nil];
}
//在图片上加图片
-
(
void
)
selectPhotos
:
(
UIGestureRecognizer
*
)
tpGe
{
NSArray
*
photosArr
=
[[
XFDB
sharedInstance
]
fetchAllPhotosFromLocal
];
if
(
photosArr
.
count
>
0
)
{
[
self
photosDisplay
];
}
else
{
self
.
m_actionSheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
@"打开照相机"
,
@"从手机相册获取"
,
nil
];
[
_m_actionSheet
showInView
:
self
.
view
];
}
}
#pragma mark btn action
-
(
void
)
photosDisplay
{
// HGPhWViewController *ghphVC = [[HGPhWViewController alloc]init];
[
self
PushViewController
:[
HGPhWViewController
shareInstance
]
animated
:
YES
];
}
#pragma mark - ZYQAssetPickerController Delegate
-
(
void
)
assetPickerController
:
(
ZYQAssetPickerController
*
)
picker
didFinishPickingAssets
:
(
NSArray
*
)
assets
{
if
(
_imgesMuArr
.
count
>
0
)
{
[
_imgesMuArr
removeAllObjects
];
}
for
(
int
i
=
0
;
i
<
assets
.
count
;
i
++
)
{
ALAsset
*
asset
=
assets
[
i
];
//获取url
// UIImage *img = [[UIImage alloc]initWithCGImage:[asset thumbnail]];
CGImageRef
ref
=
[[
asset
defaultRepresentation
]
fullResolutionImage
];
UIImage
*
img
=
[[
UIImage
alloc
]
initWithCGImage
:
ref
];
NSData
*
imgData
=
UIImagePNGRepresentation
(
img
);
[
self
savePhotoToDB
:
imgData
];
// UIImage *tempImg = [UIImage imageWithCGImage:[asset po]];
[
self
.
imgesMuArr
addObject
:
img
];
//[UIImage imageNamed:@"AttachCamera"]
}
// [[HGPhWViewController shareInstance] addPhotosWithArrayImgs:_imgesMuArr];
[
self
PushViewController
:[
HGPhWViewController
shareInstance
]
animated
:
YES
];
}
-
(
void
)
buildBottomButton
{
// 提交反馈
UIButton
*
btnBack
=
[
IBTUIButton
RoundCornerBtnWithTitle
:
@"提交反馈"
bgColor
:
nil
];
btnBack
.
frame
=
(
CGRect
)
{
.
origin
.
x
=
BTN_PADDING
,
.
origin
.
y
=
self
.
view
.
height
-
64
-
BTN_HEIGHT
-
10
,
.
size
.
width
=
BOTTOM_BTN_WIDTH
,
.
size
.
height
=
BTN_HEIGHT
};
[
btnBack
addTarget
:
self
action
:
@selector
(
commitFeedback
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
view
addSubview
:
btnBack
];
}
-
(
void
)
commitFeedback
{
[
self
saveSurveyResult
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
#pragma mark - 接口调用:3.1 新增行情反馈
-
(
void
)
saveSurveyResult
{
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
// [self backSurvey];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@"返回异常"
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
NSDictionary
*
paramDict
=
@{
@"result"
:
[
self
getSurveyResult
],
@"attachments"
:
[
self
getAttachmentArray
]};
[[
ICRHTTPController
sharedController
]
surveySaveResultWithDict
:
paramDict
surveyUuid
:
_surveyUuid
success
:
succ
failure
:
fail
];
}
-
(
NSArray
*
)
getAttachmentArray
{
NSMutableArray
*
attachArr
=
[
NSMutableArray
array
];
NSMutableArray
*
resultMuArr
=
[
NSMutableArray
array
];
NSMutableArray
*
arrImgsData
=
[[
XFDB
sharedInstance
]
fetchAllPhotosDataFromLocal
];
if
(
arrImgsData
.
count
==
0
)
{
// return attachArr;
}
else
{
for
(
int
count
=
0
;
count
<
arrImgsData
.
count
;
count
++
)
{
NSData
*
data
=
arrImgsData
[
count
];
NSString
*
fileName
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
NSMutableDictionary
*
phontoMuDict
=
[
NSMutableDictionary
dictionaryWithObjects
:@[
@""
,
data
]
forKeys
:@[
@"fileName"
,
@"content"
]];
[
attachArr
addObject
:
phontoMuDict
];
}
}
return
[
NSArray
arrayWithArray
:
attachArr
];
}
#pragma mark SurveyResult数据结构
-
(
NSDictionary
*
)
getSurveyResult
{
ICRUserUtil
*
userU
=
[
ICRUserUtil
sharedInstance
];
NSDictionary
*
dict
=
@{
@"userUuid"
:
userU
.
userId
,
@"userCode"
:
userU
.
userCode
,
@"userName"
:
userU
.
userName
,
@"unit"
:
@""
,
@"price"
:
[
self
getTextFieldTextWithRow
:
kfeedbackCellPrice
],
@"place"
:
[
self
getTextFieldTextWithRow
:
kfeedbackCellPlace
],
@"capacity"
:
[
self
getTextFieldTextWithRow
:
kfeedbackCellCapacity
],
@"quality"
:
[
self
getTextFieldTextWithRow
:
kfeedbackCellQulity
]};
return
dict
;
}
-
(
NSString
*
)
getTextFieldTextWithRow
:
(
NSInteger
)
cellRow
{
NSString
*
textStr
=
[
NSString
string
];
IBTTableViewCellInfo
*
cellInfo
=
[
_tableViewInfo
getCellAtSection
:
0
row
:
cellRow
];
UITextField
*
titleTextF
=
[
cellInfo
getUserInfoValueForKey
:
CInfoEditorKey
];
if
(
!
titleTextF
.
text
||
[
titleTextF
.
text
isEqual
:[
NSNull
null
]])
{
textStr
=
@""
;
}
else
{
textStr
=
titleTextF
.
text
;
}
return
textStr
;
}
+
(
NSString
*
)
idIsNilOrNullToString
:
(
id
)
data
{
NSString
*
returnStr
=
[
NSString
string
];
if
([
data
isEqual
:[
NSNull
null
]]
||
!
data
)
{
data
=
@""
;
}
return
data
;
}
#pragma 把选择的图片放入到本地数据库中
-
(
void
)
savePhotoToDB
:
(
NSData
*
)
imgData
{
XFPhoto
*
xfphoto
=
[[
XFPhoto
alloc
]
initWithPhotoData
:
imgData
];
BOOL
isSave
=
[[
XFDB
sharedInstance
]
savePhoto
:
xfphoto
];
if
(
isSave
)
{
NSLog
(
@"保存成功"
);
}
else
{
NSLog
(
@"保存失败"
);
}
}
@end
XFFruit/ViewControllers/XFDB.h
0 → 100644
View file @
02b8c8df
//
// XFDB.h
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <Foundation/Foundation.h>
@class
XFPhoto
;
@interface
XFDB
:
NSObject
+
(
instancetype
)
sharedInstance
;
-
(
BOOL
)
savePhoto
:
(
XFPhoto
*
)
aphoto
;
-
(
BOOL
)
deletePhoto
:
(
NSData
*
)
photoData
;
-
(
NSMutableArray
*
)
fetchAllPhotosFromLocal
;
-
(
NSMutableArray
*
)
fetchAllPhotosDataFromLocal
;
@end
XFFruit/ViewControllers/XFDB.m
0 → 100644
View file @
02b8c8df
//
// XFDB.m
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "XFDB.h"
#import "XFPhoto.h"
//FMDB
#define DATABASE_PATH [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]stringByAppendingString:@"/.db"]
@implementation
XFDB
+
(
instancetype
)
sharedInstance
{
static
XFDB
*
_sharedinstance
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
_sharedinstance
=
[[
self
alloc
]
init
];
});
return
_sharedinstance
;
}
+
(
BOOL
)
checkTableCreatedInDb
:
(
FMDatabase
*
)
db
{
NSString
*
createStr
=
@"CREATE TABLE IF NOT EXISTS 'xfphoto'(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, photoData VARCHAR)"
;
//,position INTEGER
BOOL
worked
=
[
db
executeUpdate
:
createStr
];
return
worked
;
}
-
(
BOOL
)
savePhoto
:
(
XFPhoto
*
)
aphoto
{
FMDatabase
*
db
=
[
FMDatabase
databaseWithPath
:
DATABASE_PATH
];
if
(
!
[
db
open
])
{
NSLog
(
@"数据库打开失败"
);
return
NO
;
}
[
XFDB
checkTableCreatedInDb
:
db
];
NSString
*
insterStr
=
@"INSERT INTO 'xfphoto'('photoData') VALUES(?)"
;
BOOL
worked
=
[
db
executeUpdate
:
insterStr
,
aphoto
.
photoData
];
//[NSString stringWithFormat:@"%@",aphoto.photoData]
[
db
close
];
return
worked
;
}
-
(
BOOL
)
deletePhoto
:
(
NSData
*
)
photoData
{
FMDatabase
*
db
=
[
FMDatabase
databaseWithPath
:
DATABASE_PATH
];
if
(
!
[
db
open
])
{
NSLog
(
@"数据库打开失败"
);
return
NO
;
}
[
XFDB
checkTableCreatedInDb
:
db
];
NSString
*
delStr
=
[
NSString
stringWithFormat
:
@"DELETE FROM xfphoto where photoData = %@"
,
photoData
];
BOOL
worked
=
[
db
executeUpdate
:
delStr
];
[
db
close
];
return
worked
;
}
-
(
NSMutableArray
*
)
fetchAllPhotosFromLocal
{
NSMutableArray
*
resultArr
=
[
NSMutableArray
array
];
FMDatabase
*
db
=
[
FMDatabase
databaseWithPath
:
DATABASE_PATH
];
if
(
!
[
db
open
])
{
NSLog
(
@"数据库打开失败"
);
return
resultArr
;
}
[
XFDB
checkTableCreatedInDb
:
db
];
FMResultSet
*
rs
=
[
db
executeQuery
:
@"select * from xfphoto"
];
while
([
rs
next
])
{
XFPhoto
*
xfPhoto
=
[[
XFPhoto
alloc
]
init
];
xfPhoto
.
photoData
=
[
rs
dataForColumn
:
@"photoData"
];
// xfPhoto.position = [rs intForColumn:@"position"];
[
resultArr
addObject
:
xfPhoto
];
}
[
rs
close
];
[
db
close
];
return
resultArr
;
}
-
(
NSMutableArray
*
)
fetchAllPhotosDataFromLocal
{
NSMutableArray
*
resultArr
=
[
NSMutableArray
array
];
FMDatabase
*
db
=
[
FMDatabase
databaseWithPath
:
DATABASE_PATH
];
if
(
!
[
db
open
])
{
NSLog
(
@"数据库打开失败"
);
return
resultArr
;
}
[
XFDB
checkTableCreatedInDb
:
db
];
FMResultSet
*
rs
=
[
db
executeQuery
:
@"select * from xfphoto"
];
while
([
rs
next
])
{
NSData
*
photoData
=
[
rs
dataForColumn
:
@"photoData"
];
[
resultArr
addObject
:
photoData
];
}
[
rs
close
];
[
db
close
];
return
resultArr
;
}
@end
XFFruit/ViewControllers/XFPhoto.h
0 → 100644
View file @
02b8c8df
//
// XFPhotos.h
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface
XFPhoto
:
IBTModel
@property
(
assign
,
nonatomic
)
NSInteger
ID
;
@property
(
strong
,
nonatomic
)
NSData
*
photoData
;
//@property (assign, nonatomic) NSInteger *position;
-
(
instancetype
)
initWithPhotoData
:
(
NSData
*
)
photoData
;
@end
XFFruit/ViewControllers/XFPhoto.m
0 → 100644
View file @
02b8c8df
//
// XFPhotos.m
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "XFPhoto.h"
@implementation
XFPhoto
-
(
instancetype
)
initWithPhotoData
:(
NSData
*
)
photoData
{
self
=
[
super
init
];
if
(
self
)
{
self
.
photoData
=
photoData
;
}
return
self
;
}
@end
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