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
0be0ac22
Commit
0be0ac22
authored
9 years ago
by
n22
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加工单
parent
cca20747
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
321 additions
and
89 deletions
+321
-89
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+6
-0
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+2
-2
Contents.json
XFFruit/Images.xcassets/Survey/arrorw.imageset/Contents.json
+21
-0
arrorw.png
XFFruit/Images.xcassets/Survey/arrorw.imageset/arrorw.png
+0
-0
Contents.json
...it/Images.xcassets/Survey/tab_line.imageset/Contents.json
+22
-0
tab_line.png
...uit/Images.xcassets/Survey/tab_line.imageset/tab_line.png
+0
-0
tab_line@2x.png
.../Images.xcassets/Survey/tab_line.imageset/tab_line@2x.png
+0
-0
DataManager.m
XFFruit/Utilities/IBTUIKit/DataManager.m
+16
-13
IBTTabBarController.m
XFFruit/Utilities/IBTUIKit/IBTTabBarController.m
+1
-1
User.h
XFFruit/ViewControllers/Survey/Views/User.h
+35
-0
User.m
XFFruit/ViewControllers/Survey/Views/User.m
+13
-0
ChosePersonViewController.m
...ontrollers/Survey/controllers/ChosePersonViewController.m
+21
-8
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+18
-5
AddWorkSheetViewController.m
...ollers/WorkSheet/Controllers/AddWorkSheetViewController.m
+80
-4
TopSheetView.m
XFFruit/ViewControllers/WorkSheet/Views/TopSheetView.m
+86
-56
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
0be0ac22
...
...
@@ -345,6 +345,7 @@
C1FE50531AE024FA00C18080
/* UIAlertView+Blocks.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C1FE504D1AE024FA00C18080
/* UIAlertView+Blocks.m */
;
};
C1FE50561AE3587F00C18080
/* ICRAttachmentUnit.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C1FE50551AE3587F00C18080
/* ICRAttachmentUnit.m */
;
};
C1FE50571AE3587F00C18080
/* ICRAttachmentUnit.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C1FE50551AE3587F00C18080
/* ICRAttachmentUnit.m */
;
};
FE0C9B091B7C543D00335B39
/* User.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FE0C9B081B7C543D00335B39
/* User.m */
;
};
FE2FCC7F1B74511000BBC6FB
/* ChooseProductViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FE2FCC7E1B74511000BBC6FB
/* ChooseProductViewController.m */
;
};
FE2FCC821B745E1A00BBC6FB
/* SurveyDetailViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FE2FCC811B745E1A00BBC6FB
/* SurveyDetailViewController.m */
;
};
FE2FCC881B7492C500BBC6FB
/* ResultDetailViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FE2FCC871B7492C500BBC6FB
/* ResultDetailViewController.m */
;
};
...
...
@@ -737,6 +738,8 @@
C1FE504D1AE024FA00C18080
/* UIAlertView+Blocks.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"UIAlertView+Blocks.m"
;
sourceTree
=
"<group>"
;
};
C1FE50541AE3587F00C18080
/* ICRAttachmentUnit.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ICRAttachmentUnit.h
;
sourceTree
=
"<group>"
;
};
C1FE50551AE3587F00C18080
/* ICRAttachmentUnit.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ICRAttachmentUnit.m
;
sourceTree
=
"<group>"
;
};
FE0C9B071B7C543D00335B39
/* User.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
User.h
;
path
=
../Views/User.h
;
sourceTree
=
"<group>"
;
};
FE0C9B081B7C543D00335B39
/* User.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
User.m
;
path
=
../Views/User.m
;
sourceTree
=
"<group>"
;
};
FE2FCC7D1B74511000BBC6FB
/* ChooseProductViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ChooseProductViewController.h
;
sourceTree
=
"<group>"
;
};
FE2FCC7E1B74511000BBC6FB
/* ChooseProductViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ChooseProductViewController.m
;
sourceTree
=
"<group>"
;
};
FE2FCC801B745E1A00BBC6FB
/* SurveyDetailViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
SurveyDetailViewController.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -827,6 +830,8 @@
7217E9C81B72364300FE5C1D
/* Models */
=
{
isa
=
PBXGroup
;
children
=
(
FE0C9B071B7C543D00335B39
/* User.h */
,
FE0C9B081B7C543D00335B39
/* User.m */
,
7217E9C91B72364300FE5C1D
/* Attachment.h */
,
7217E9CA1B72364300FE5C1D
/* Attachment.m */
,
7217E9CB1B72364300FE5C1D
/* Survey.h */
,
...
...
@@ -2077,6 +2082,7 @@
C1C5644F1AD6719B006A1050
/* ICRTaskDetailViewController.m in Sources */
,
C1E1085D1ADA577500620375
/* ICRTaskDetailContentView.m in Sources */
,
C14BE30E1ADB86DB0049F1AA
/* NSData+EncodeAdditions.m in Sources */
,
FE0C9B091B7C543D00335B39
/* User.m in Sources */
,
C1E093041AC8E8E0003B7126
/* ICRCheckBox.m in Sources */
,
C1864A561B0B0D9D00D11C4E
/* ICRPostTask.m in Sources */
,
FE2FCC7F1B74511000BBC6FB
/* ChooseProductViewController.m in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
0be0ac22
...
...
@@ -1439,8 +1439,8 @@ acceptTypeJson:YES
fail
(
error
);
}
};
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetUser
]
stringByAppendingFormat
:
@"?start_date=%@&page_number=%@&page_size=%@"
,
[[
NSDate
date
]
httpParameterString
]
,
@
(
page_number
),
@
(
page_size
)];
NSString
*
dateStr
=
@"2015-06-07"
;
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetUser
]
stringByAppendingFormat
:
@"?start_date=%@&page_number=%@&page_size=%@"
,
dateStr
,
@
(
page_number
),
@
(
page_size
)];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
POST
:
encodeUrlStr
parameters
:
NULL
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Images.xcassets/Survey/arrorw.imageset/Contents.json
0 → 100644
View file @
0be0ac22
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
,
"filename"
:
"arrorw.png"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
XFFruit/Images.xcassets/Survey/arrorw.imageset/arrorw.png
0 → 100644
View file @
0be0ac22
3.06 KB
This diff is collapsed.
Click to expand it.
XFFruit/Images.xcassets/Survey/tab_line.imageset/Contents.json
0 → 100644
View file @
0be0ac22
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
,
"filename"
:
"tab_line.png"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
,
"filename"
:
"tab_line@2x.png"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
XFFruit/Images.xcassets/Survey/tab_line.imageset/tab_line.png
0 → 100644
View file @
0be0ac22
934 Bytes
This diff is collapsed.
Click to expand it.
XFFruit/Images.xcassets/Survey/tab_line.imageset/tab_line@2x.png
0 → 100644
View file @
0be0ac22
959 Bytes
This diff is collapsed.
Click to expand it.
XFFruit/Utilities/IBTUIKit/DataManager.m
View file @
0be0ac22
...
...
@@ -26,7 +26,7 @@
-
(
void
)
createDB
{
//先获取app.db在沙盒中的路径
NSString
*
path
=
[
self
getFullDatabasePathFromFileName
:
@"
kitchen
.db"
];
NSString
*
path
=
[
self
getFullDatabasePathFromFileName
:
@"
XFFruit
.db"
];
//创建数据库对象
_database
=
[[
FMDatabase
alloc
]
initWithPath
:
path
];
//打开数据库
...
...
@@ -40,21 +40,24 @@
#pragma mark - 获取数据库文件的全路径
-
(
NSString
*
)
getFullDatabasePathFromFileName
:
(
NSString
*
)
name
{
//文件夹路径
NSString
*
userFolderPath
=
[
NSString
stringWithFormat
:
@"%@/Documents"
,
NSHomeDirectory
()];
//库文件路径
NSString
*
chatDBPath
=
[
userFolderPath
stringByAppendingFormat
:
@"/%@"
,
name
];
//文件管理单例
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
//如果文件夹不存在,则创建文件夹
if
(
!
[
fileManager
fileExistsAtPath
:
userFolderPath
])
{
[
fileManager
createDirectoryAtPath
:
userFolderPath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
[
fileManager
createFileAtPath
:
chatDBPath
contents
:
nil
attributes
:
nil
];
//获取沙盒路径
NSString
*
path
=
NSHomeDirectory
();
NSString
*
docPath
=
[
path
stringByAppendingPathComponent
:
@"Documents"
];
//要判断Documents存在不存在
NSFileManager
*
fm
=
[
NSFileManager
defaultManager
];
if
([
fm
fileExistsAtPath
:
docPath
])
{
//存在
//返回文件在Documents 目录下得路径
return
[
docPath
stringByAppendingFormat
:
@"/%@"
,
name
];
}
else
{
NSLog
(
@"Documents不存在"
);
//不存在可以自己创建一个Documents目录
return
nil
;
}
return
chatDBPath
;
}
-
(
void
)
creatTable
{
NSArray
*
arr
=
@[
@"CREATE TABLE IF NOT EXISTS kitchen(serial integer PRIMARY KEY AUTOINCREMENT,foreign_id Varchar(1024),type Varchar(1024),title Varchar(1024),create_time Varchar(1024),name Varchar(1024),image Varchar(1024))"
,
@"CREATE TABLE IF NOT EXISTS menu(serial integer PRIMARY KEY AUTOINCREMENT,id Varchar(1024),sUrl Varchar(1024),title Varchar(1024),works Varchar(1024),favourite Varchar(1024),view Varchar(1024),url Varchar(1024))"
,
@"CREATE TABLE IF NOT EXISTS fresh(serial integer PRIMARY KEY AUTOINCREMENT,id Varchar(1024),title Varchar(1024),url Varchar(1024),time Varchar(1024),desp Varchar(1024))"
];
NSArray
*
arr
=
@[
@"CREATE TABLE IF NOT EXISTS kitchen(serial integer PRIMARY KEY AUTOINCREMENT,foreign_id Varchar(1024),type Varchar(1024),title Varchar(1024),create_time Varchar(1024),name Varchar(1024),image Varchar(1024))"
,
@"CREATE TABLE IF NOT EXISTS menu(serial integer PRIMARY KEY AUTOINCREMENT,id Varchar(1024),sUrl Varchar(1024),title Varchar(1024),works Varchar(1024),favourite Varchar(1024),view Varchar(1024),url Varchar(1024))"
,
@"CREATE TABLE IF NOT EXISTS fresh(serial integer PRIMARY KEY AUTOINCREMENT,id Varchar(1024),title Varchar(1024),url Varchar(1024),time Varchar(1024),desp Varchar(1024))"
];
//遍历数组创建表
for
(
NSString
*
sql
in
arr
)
{
BOOL
isSeccess
=
[
_database
executeUpdate
:
sql
];
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Utilities/IBTUIKit/IBTTabBarController.m
View file @
0be0ac22
...
...
@@ -145,7 +145,7 @@
for
(
UIViewController
*
vCtrl
in
controllers
)
{
// Normal图片命名 Tab+|subname|+Icon+@2x.png
iconImgName
=
[
NSString
stringWithFormat
:
@"Tab%@Icon"
,
vCtrl
.
title
];
iconImgName
=
[
NSString
stringWithFormat
:
@"Tab%@Icon"
,
vCtrl
.
title
];
UITabBarItem
*
tabBarItem
=
[
UITabBarItem
itemWithTitle
:[
IBTCommon
localizableString
:
vCtrl
.
title
]
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/Views/User.h
0 → 100644
View file @
0be0ac22
//
// User.h
// XFFruit
//
// Created by n22 on 15/8/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface
User
:
IBTModel
@property
(
nonatomic
,
strong
)
NSString
*
uuid
;
//唯一标识
@property
(
nonatomic
,
strong
)
NSString
*
version
;
//版本号
@property
(
nonatomic
,
strong
)
NSDate
*
create_time
;
//创建时间
@property
(
nonatomic
,
strong
)
NSString
*
create_id
;
//创建人代码
@property
(
nonatomic
,
strong
)
NSString
*
create_operName
;
//创建人名称
@property
(
nonatomic
,
strong
)
NSDate
*
lastModify_time
;
//最后修改时间
@property
(
nonatomic
,
strong
)
NSString
*
lastModify_id
;
//最后修改人代码
@property
(
nonatomic
,
strong
)
NSString
*
lastModify_operName
;
//最后修改人名称
@property
(
nonatomic
,
strong
)
NSArray
*
company
;
//所属公司
@property
(
nonatomic
,
strong
)
NSString
*
login
;
//用户名
@property
(
nonatomic
,
strong
)
NSString
*
name
;
//用户名
@property
(
nonatomic
,
strong
)
NSString
*
password
;
//密码
@property
(
nonatomic
,
strong
)
NSString
*
mobile
;
//手机号
@property
(
nonatomic
,
strong
)
NSString
*
email
;
//邮箱
@property
(
nonatomic
,
assign
)
NSInteger
*
enabled
;
//是否启用
@property
(
nonatomic
,
strong
)
NSString
*
position
;
//职位
@property
(
nonatomic
,
strong
)
NSString
*
address
;
//地址
@property
(
nonatomic
,
strong
)
NSString
*
belongOrg
;
//所属组织
@property
(
nonatomic
,
strong
)
NSString
*
remark
;
//备注
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/Views/User.m
0 → 100644
View file @
0be0ac22
//
// User.m
// XFFruit
//
// Created by n22 on 15/8/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "User.h"
@implementation
User
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/controllers/ChosePersonViewController.m
View file @
0be0ac22
...
...
@@ -9,7 +9,7 @@
#import "ChosePersonViewController.h"
#import "MaskCell.h"
#import "SurveyUser.h"
#import "
Survey
User.h"
#import "User.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChosePersonViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
...
...
@@ -43,7 +43,7 @@
NSArray
*
records
=
dataDict
[
@"records"
];
if
(
records
.
count
>
0
)
{
for
(
NSDictionary
*
recordDict
in
records
)
{
SurveyUser
*
user
=
[[
Survey
User
alloc
]
init
];
User
*
user
=
[[
User
alloc
]
init
];
[
user
setValuesForKeysWithDictionary
:
recordDict
];
[
_dataArr
addObject
:
user
];
}
...
...
@@ -105,10 +105,23 @@
-
(
void
)
sureClick
{
NSMutableArray
*
arr
=
[[
NSMutableArray
alloc
]
init
];
for
(
NSIndexPath
*
index
in
_indexArr
)
{
SurveyUser
*
user
=
_dataArr
[
index
.
row
];
User
*
user
=
_dataArr
[
index
.
row
];
SurveyUser
*
survey
=
[[
SurveyUser
alloc
]
init
];
survey
.
userUuid
=
user
.
uuid
;
survey
.
userCode
=
user
.
login
;
survey
.
userName
=
user
.
name
;
[
arr
addObject
:
survey
];
}
if
(
arr
.
count
==
0
)
{
SurveyUser
*
user
=
[[
SurveyUser
alloc
]
init
];
user
.
userUuid
=
@"5a7417014e4c2928014e4dea21fb002f"
;
user
.
userName
=
@"栗阳"
;
user
.
userCode
=
@"admin"
;
[
arr
addObject
:
user
];
self
.
chosePerson
(
arr
);
}
else
{
self
.
chosePerson
(
arr
);
}
self
.
chosePerson
(
arr
);
[
self
PopViewControllerAnimated
:
YES
];
}
...
...
@@ -141,8 +154,8 @@
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
_dataArr
.
count
>
0
)
{
Survey
User
*
user
=
_dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
user
.
userN
ame
];
User
*
user
=
_dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
user
.
n
ame
];
}
return
cell
;
...
...
@@ -159,8 +172,8 @@
NSString
*
personStr
=
@""
;
for
(
NSIndexPath
*
index
in
_indexArr
)
{
Survey
User
*
user
=
_dataArr
[
index
.
row
];
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@、"
,
user
.
userN
ame
];
User
*
user
=
_dataArr
[
index
.
row
];
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@、"
,
user
.
n
ame
];
}
_selectTextFiled
.
text
=
personStr
;
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
0be0ac22
...
...
@@ -103,13 +103,15 @@ typedef enum : NSUInteger {
case
SaveTag
:
{
if
([
self
checkSurvey
])
{
[
self
saveSurvey
];
[
self
saveSurvey
:
@"initial"
message
:
@"正在保存..."
];
}
}
break
;
case
CommitTag
:
{
if
([
self
checkSurvey
])
{
[
self
saveSurvey
:
@"submitted"
message
:
@"正在提交..."
];
}
}
break
;
default
:
...
...
@@ -129,7 +131,7 @@ typedef enum : NSUInteger {
#pragma mark - 保存
-
(
void
)
saveSurvey
-
(
void
)
saveSurvey
:
(
NSString
*
)
state
message
:
(
NSString
*
)
msg
{
//保存
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
...
...
@@ -139,6 +141,8 @@ typedef enum : NSUInteger {
NSString
*
message
=
data
[
@"message"
];
if
(
success
==
1
)
{
//成功
[
IBTLoadingView
showTips
:
@""
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
...
...
@@ -148,8 +152,17 @@ typedef enum : NSUInteger {
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
NSDictionary
*
dict
=
@{
@"uuid"
:
@""
,
@"billnumber"
:
@""
,
@"title"
:
self
.
surveyTitle
,
@"productUuid"
:
self
.
productUuid
,
@"productCode"
:
self
.
productCode
,
@"productName"
:
self
.
productName
,
@"beginDate"
:
self
.
beginDate
,
@"endDate"
:
self
.
endDate
,
@"remark"
:
self
.
remark
,
@"users"
:
self
.
users
};
[
IBTLoadingView
showProgressLabel
:
@"正在保存..."
];
NSDictionary
*
dict
=
@{
@"billnumber"
:
@""
,
@"title"
:
self
.
surveyTitle
,
@"state"
:
state
,
@"productUuid"
:
self
.
productUuid
,
@"productCode"
:
self
.
productCode
,
@"productName"
:
self
.
productName
,
@"beginDate"
:
self
.
beginDate
,
@"endDate"
:
self
.
endDate
,
@"remark"
:
self
.
remark
,
@"users"
:
self
.
users
};
[
IBTLoadingView
showProgressLabel
:
msg
];
[[
ICRHTTPController
sharedController
]
saveSurveyWithAuthenticode
:
dict
success
:
succ
failure
:
fail
];
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/WorkSheet/Controllers/AddWorkSheetViewController.m
View file @
0be0ac22
...
...
@@ -9,11 +9,20 @@
#import "AddWorkSheetViewController.h"
#import "TopSheetView.h"
#define TopHeight 200
@interface
AddWorkSheetViewController
()
<
TopSheetViewDelegate
>
#define TopHeight 284
#define BottomHeight 300
#define SpaceHeight 20
#define ContentHeight 44
#define BeginTag 7000
#define SpaceWidth 20
#define BtnWidth (ScreenSize.width - 20*4)/3
@interface
AddWorkSheetViewController
()
<
TopSheetViewDelegate
,
UIScrollViewDelegate
>
{
UIScrollView
*
_scrollView
;
TopSheetView
*
_sheetView
;
UIView
*
_bottomView
;
UIScrollView
*
_bottomSV
;
UIImageView
*
_moveImageView
;
}
@end
...
...
@@ -25,12 +34,79 @@
[
self
bulidLayout
];
}
-
(
void
)
bulidLayout
{
self
.
view
.
backgroundColor
=
XXFBgColor
;
_scrollView
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
)];
_scrollView
.
showsHorizontalScrollIndicator
=
NO
;
_scrollView
.
showsVerticalScrollIndicator
=
NO
;
_scrollView
.
contentSize
=
CGSizeMake
(
ScreenSize
.
width
,
TopHeight
+
BottomHeight
+
SpaceHeight
*
2
);
[
self
.
view
addSubview
:
_scrollView
];
_sheetView
=
[[
TopSheetView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
TopHeight
)];
_sheetView
.
delegate
=
self
;
[
self
.
view
addSubview
:
_sheetView
];
[
_scrollView
addSubview
:
_sheetView
];
_bottomView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
CGRectGetMaxY
(
_sheetView
.
frame
)
+
20
,
ScreenSize
.
width
,
BottomHeight
)];
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
[
self
createBottomView
];
}
-
(
void
)
createBottomView
{
NSArray
*
arr
=
@[
@"原料明细"
,
@"成品明细"
,
@"费用明细"
];
_bottomSV
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
ContentHeight
+
4
,
ScreenSize
.
width
,
CGRectGetHeight
(
_bottomView
.
frame
)
-
ContentHeight
-
2
)];
_bottomSV
.
showsHorizontalScrollIndicator
=
NO
;
_bottomSV
.
showsVerticalScrollIndicator
=
NO
;
_bottomSV
.
pagingEnabled
=
YES
;
_bottomSV
.
delegate
=
self
;
_bottomSV
.
backgroundColor
=
[
UIColor
yellowColor
];
_bottomSV
.
contentSize
=
CGSizeMake
(
ScreenSize
.
width
*
arr
.
count
,
CGRectGetHeight
(
_bottomSV
.
frame
));
[
_bottomView
addSubview
:
_bottomSV
];
for
(
NSInteger
i
=
0
;
i
<
arr
.
count
;
i
++
)
{
UIButton
*
btn
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
[
btn
setTitle
:
arr
[
i
]
forState
:
UIControlStateNormal
];
btn
.
frame
=
CGRectMake
(
SpaceWidth
+
(
BtnWidth
+
SpaceWidth
)
*
i
,
0
,
BtnWidth
,
ContentHeight
);
[
btn
setTitleColor
:
HexColor
(
@"444444"
)
forState
:
UIControlStateNormal
];
btn
.
titleLabel
.
font
=
FontSize
(
16
);
btn
.
tag
=
i
+
BeginTag
;
[
btn
addTarget
:
self
action
:
@selector
(
btnClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_bottomView
addSubview
:
btn
];
UIView
*
image
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetWidth
(
_bottomSV
.
frame
)
*
i
,
0
,
CGRectGetWidth
(
_bottomSV
.
frame
),
CGRectGetHeight
(
_bottomSV
.
frame
))];
if
(
i
==
0
)
{
image
.
backgroundColor
=
[
UIColor
redColor
];
}
else
if
(
i
==
1
){
image
.
backgroundColor
=
[
UIColor
blackColor
];
}
else
if
(
i
==
2
){
image
.
backgroundColor
=
[
UIColor
blueColor
];
}
[
_bottomSV
addSubview
:
image
];
}
_moveImageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
SpaceWidth
,
ContentHeight
,
BtnWidth
,
4
)];
_moveImageView
.
image
=
[
UIImage
imageNamed
:
@"tab_line"
];
[
_bottomView
addSubview
:
_moveImageView
];
}
-
(
void
)
btnClick
:
(
UIButton
*
)
btn
{
NSInteger
index
=
btn
.
tag
-
BeginTag
;
[
UIView
animateWithDuration
:
0
.
5
animations
:
^
{
CGRect
moveFrame
=
_moveImageView
.
frame
;
moveFrame
.
origin
.
x
=
SpaceWidth
+
(
BtnWidth
+
SpaceWidth
)
*
index
;
_moveImageView
.
frame
=
moveFrame
;
}];
}
-
(
void
)
scrollViewDidEndDecelerating
:
(
UIScrollView
*
)
scrollView
{
if
(
scrollView
==
_bottomSV
)
{
CGFloat
index
=
_bottomSV
.
contentOffset
.
x
/
_bottomSV
.
frame
.
size
.
width
;
}
}
#pragma mark - 协议方法
-
(
void
)
hiddenKeyBoard
{
[
self
keyboardHidden
];
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/WorkSheet/Views/TopSheetView.m
View file @
0be0ac22
...
...
@@ -7,14 +7,19 @@
//
#import "TopSheetView.h"
#import "SurveyCell.h"
#define LeftMargin 15
#define TopMargin
1
0
#define TopMargin
2
0
#define LeftWidth 80
#define
ContentHeight 25
#define
TableHeight 44
#define SpaceHeight 10
#define TitleSize 16
@interface
TopSheetView
()
<
UITextFieldDelegate
,
HPGrowingTextViewDelegate
>
@interface
TopSheetView
()
<
UITableViewDataSource
,
UITableViewDelegate
,
HPGrowingTextViewDelegate
,
UITextFieldDelegate
>
{
UITableView
*
_tableView
;
NSMutableArray
*
_dataArr
;
}
@end
...
...
@@ -31,62 +36,87 @@
#pragma mark - 布局
-
(
void
)
bulidLayout
{
self
.
backgroundColor
=
XXFBgColor
;
_dataArr
=
[
NSMutableArray
array
];
NSArray
*
arr
=
@[
@"标题:"
,
@"供应商:"
,
@"联系人:"
,
@"联系电话:"
,
@"加工工厂:"
,
@"备注:"
];
for
(
NSInteger
i
=
0
;
i
<
arr
.
count
;
i
++
)
{
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
LeftWidth
,
ContentHeight
)];
label
.
text
=
arr
[
i
];
label
.
font
=
FontSize
(
17
);
[
self
addSubview
:
label
];
if
(
i
==
0
)
{
self
.
titleTextFiled
=
[
self
getTextFileWithFrame
:
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
)
title
:
@"请输入标题"
];
}
else
if
(
i
==
1
){
self
.
supplierBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
supplierBtn
.
frame
=
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
);
[
self
addSubview
:
self
.
supplierBtn
];
self
.
supplierLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
frame
.
size
.
width
-
LeftMargin
*
4
-
LeftWidth
,
ContentHeight
)];
self
.
supplierLabel
.
font
=
FontSize
(
15
);
self
.
supplierLabel
.
backgroundColor
=
[
UIColor
redColor
];
[
self
.
supplierBtn
addSubview
:
self
.
supplierLabel
];
}
else
if
(
i
==
2
){
self
.
peopleTextFiled
=
[
self
getTextFileWithFrame
:
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
)
title
:
@"请输入联系人"
];
}
else
if
(
i
==
3
){
self
.
phoneTextFiled
=
[
self
getTextFileWithFrame
:
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
)
title
:
@"请输入联系电话"
];
}
else
if
(
i
==
4
){
self
.
factoryBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
factoryBtn
.
frame
=
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
);
[
self
addSubview
:
self
.
factoryBtn
];
self
.
factoryLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
frame
.
size
.
width
-
LeftMargin
*
4
-
LeftWidth
,
ContentHeight
)];
self
.
factoryLabel
.
font
=
FontSize
(
15
);
self
.
factoryLabel
.
backgroundColor
=
[
UIColor
redColor
];
[
self
.
factoryBtn
addSubview
:
self
.
factoryLabel
];
}
else
if
(
i
==
5
){
self
.
remarkTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
LeftWidth
+
LeftMargin
,
TopMargin
+
(
ContentHeight
+
SpaceHeight
)
*
i
,
self
.
frame
.
size
.
width
-
LeftMargin
*
2
-
LeftWidth
,
ContentHeight
)];
self
.
remarkTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
self
.
remarkTextView
.
minNumberOfLines
=
1
;
self
.
remarkTextView
.
maxNumberOfLines
=
2
;
self
.
remarkTextView
.
font
=
FontSize
(
15
);
self
.
remarkTextView
.
textAlignment
=
NSTextAlignmentLeft
;
self
.
remarkTextView
.
delegate
=
self
;
self
.
remarkTextView
.
returnKeyType
=
UIReturnKeyDone
;
self
.
remarkTextView
.
placeholder
=
@"输入备注内容"
;
[
self
addSubview
:
self
.
remarkTextView
];
[
_dataArr
addObjectsFromArray
:
arr
];
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
self
.
frame
.
size
.
width
,
self
.
frame
.
size
.
height
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
_tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
_tableView
.
bounces
=
NO
;
_tableView
.
delegate
=
self
;
_tableView
.
dataSource
=
self
;
[
self
addSubview
:
_tableView
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
_dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"cellID"
;
SurveyCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
cell
==
nil
)
{
cell
=
[[
SurveyCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
if
(
indexPath
.
row
==
1
||
indexPath
.
row
==
4
)
{
cell
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
}
[
self
createViewInCell
:
cell
indexPath
:
indexPath
];
}
[
cell
setTitleStr
:
_dataArr
[
indexPath
.
row
]];
return
cell
;
}
-
(
UITextField
*
)
getTextFileWithFrame
:
(
CGRect
)
frame
title
:
(
NSString
*
)
title
{
UITextField
*
textField
=
[[
UITextField
alloc
]
initWithFrame
:
frame
];
textField
.
textAlignment
=
NSTextAlignmentLeft
;
textField
.
textColor
=
HexColor
(
@"444444"
);
textField
.
borderStyle
=
UITextBorderStyleRoundedRect
;
textField
.
placeholder
=
title
;
textField
.
font
=
FontSize
(
15
);
textField
.
delegate
=
self
;
textField
.
returnKeyType
=
UIReturnKeyDone
;
[
self
addSubview
:
textField
];
return
textField
;
-
(
void
)
createViewInCell
:
(
SurveyCell
*
)
cell
indexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
||
indexPath
.
row
==
2
||
indexPath
.
row
==
3
)
{
UITextField
*
textField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
10
,
TableHeight
)];
textField
.
textAlignment
=
NSTextAlignmentRight
;
textField
.
textColor
=
HexColor
(
@"444444"
);
textField
.
font
=
FontSize
(
15
);
textField
.
returnKeyType
=
UIReturnKeyDone
;
textField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
textField
];
if
(
indexPath
.
row
==
0
)
{
self
.
titleTextFiled
=
textField
;
self
.
titleTextFiled
.
placeholder
=
@"请输入标题"
;
}
else
if
(
indexPath
.
row
==
2
){
self
.
peopleTextFiled
=
textField
;
self
.
peopleTextFiled
.
placeholder
=
@"请输入联系人"
;
}
else
if
(
indexPath
.
row
==
3
){
self
.
phoneTextFiled
=
textField
;
self
.
phoneTextFiled
.
placeholder
=
@"请输入联系人手机"
;
}
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
self
.
remarkTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
10
,
TableHeight
)];
self
.
remarkTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
self
.
remarkTextView
.
minNumberOfLines
=
1
;
self
.
remarkTextView
.
maxNumberOfLines
=
2
;
self
.
remarkTextView
.
font
=
FontSize
(
15
);
self
.
remarkTextView
.
textAlignment
=
NSTextAlignmentRight
;
self
.
remarkTextView
.
delegate
=
self
;
self
.
remarkTextView
.
returnKeyType
=
UIReturnKeyDone
;
self
.
remarkTextView
.
placeholder
=
@"输入备注内容"
;
[
cell
.
contentView
addSubview
:
self
.
remarkTextView
];
}
else
{
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
10
,
TableHeight
))];
contentLabel
.
textAlignment
=
NSTextAlignmentRight
;
contentLabel
.
textColor
=
HexColor
(
@"bbbbbb"
);
contentLabel
.
font
=
FontSize
(
TitleSize
);
[
cell
.
contentView
addSubview
:
contentLabel
];
if
(
indexPath
.
row
==
1
)
{
contentLabel
.
text
=
@"选择供应商"
;
self
.
supplierLabel
=
contentLabel
;
}
else
if
(
indexPath
.
row
==
4
){
contentLabel
.
text
=
@"选择加工工厂"
;
self
.
factoryLabel
=
contentLabel
;
}
}
}
-
(
BOOL
)
growingTextViewShouldReturn
:
(
HPGrowingTextView
*
)
growingTextView
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment