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
8956cf5d
Commit
8956cf5d
authored
Aug 24, 2015
by
n22
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
排序
parent
76416662
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
40 deletions
+96
-40
BoltMaskView.h
XFFruit/ViewControllers/Survey/Views/BoltMaskView.h
+1
-0
BoltMaskView.m
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
+35
-12
SortMaskView.m
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
+3
-1
SurveyViewController.m
...ViewControllers/Survey/controllers/SurveyViewController.m
+57
-27
No files found.
XFFruit/ViewControllers/Survey/Views/BoltMaskView.h
View file @
8956cf5d
...
...
@@ -12,6 +12,7 @@
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
;
-
(
void
)
getTitleLike
:(
NSString
*
)
titleLike
;
-
(
void
)
getBillNumber
:(
NSString
*
)
billNumber
;
-
(
void
)
clearBoltInformation
;
@end
...
...
XFFruit/ViewControllers/Survey/Views/BoltMaskView.m
View file @
8956cf5d
...
...
@@ -12,6 +12,8 @@
#define LeftMargin 80
#define TotalHeight 224
#define LeftHeight 44
#define BottomHeight 50
@interface
BoltMaskView
()
<
UITextFieldDelegate
>
{
UIView
*
_leftView
;
...
...
@@ -22,6 +24,7 @@
NSString
*
_state
;
NSString
*
_billNumber
;
NSString
*
_title
;
UIButton
*
_clearBtn
;
}
@property
(
nonatomic
,
strong
)
NSString
*
state
;
@property
(
nonatomic
,
strong
)
NSString
*
title
;
...
...
@@ -67,9 +70,9 @@
#pragma mark - 创建视图
-
(
void
)
createView
{
_leftView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
LeftMargin
,
self
.
frame
.
size
.
height
)];
_leftView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
LeftMargin
,
self
.
frame
.
size
.
height
-
BottomHeight
)];
[
self
addSubview
:
_leftView
];
NSArray
*
arr
=
@[
@"按状态"
,
@"
条件一"
,
@"条件二
"
];
NSArray
*
arr
=
@[
@"按状态"
,
@"
单号"
,
@"标题
"
];
for
(
NSInteger
i
=
0
;
i
<
arr
.
count
;
i
++
)
{
UIButton
*
button
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
button
.
frame
=
CGRectMake
(
0
,
LeftHeight
*
i
,
LeftMargin
,
LeftHeight
);
...
...
@@ -85,15 +88,22 @@
[
button
addTarget
:
self
action
:
@selector
(
leftBtnClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_leftView
addSubview
:
button
];
}
_clearBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_clearBtn
.
frame
=
CGRectMake
(
0
,
CGRectGetMaxY
(
_leftView
.
frame
),
self
.
frame
.
size
.
width
,
BottomHeight
);
[
_clearBtn
setTitle
:
@"清空选项"
forState
:
UIControlStateNormal
];
[
_clearBtn
setTitleColor
:
HexColor
(
@"444444"
)
forState
:
UIControlStateNormal
];
_clearBtn
.
titleLabel
.
font
=
FontSize
(
15
);
[
_clearBtn
addTarget
:
self
action
:
@selector
(
clearBolt
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
addSubview
:
_clearBtn
];
}
-
(
void
)
createRightView
{
_titleView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
)];
_titleView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
-
BottomHeight
)];
_titleView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
self
addSubview
:
_titleView
];
UILabel
*
titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
,
20
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
20
)];
titleLabel
.
font
=
FontSize
(
15
);
titleLabel
.
text
=
@"
标题
类似于:"
;
titleLabel
.
text
=
@"类似于:"
;
[
_titleView
addSubview
:
titleLabel
];
self
.
titleFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
10
,
CGRectGetMaxY
(
titleLabel
.
frame
)
+
10
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
30
)];
self
.
titleFiled
.
textAlignment
=
NSTextAlignmentLeft
;
...
...
@@ -106,12 +116,12 @@
[
_titleView
addSubview
:
self
.
titleFiled
];
_billNumberView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
)];
_billNumberView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
-
BottomHeight
)];
_billNumberView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
self
addSubview
:
_billNumberView
];
UILabel
*
billLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
,
20
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
20
)];
billLabel
.
font
=
FontSize
(
15
);
billLabel
.
text
=
@"
单号
:"
;
billLabel
.
text
=
@"
类似于
:"
;
[
_billNumberView
addSubview
:
billLabel
];
self
.
billFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
10
,
CGRectGetMaxY
(
billLabel
.
frame
)
+
10
,
(
ScreenSize
.
width
-
LeftMargin
-
10
*
2
),
30
)];
...
...
@@ -124,12 +134,12 @@
self
.
billFiled
.
delegate
=
self
;
[
_billNumberView
addSubview
:
self
.
billFiled
];
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
)
style
:(
UITableViewStylePlain
)];
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
0
,
ScreenSize
.
width
-
LeftMargin
,
self
.
frame
.
size
.
height
-
BottomHeight
)
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
addSubview
:
self
.
tableView
];
}
...
...
@@ -164,6 +174,23 @@
break
;
}
}
-
(
void
)
clearBolt
{
if
(
_titleFiled
.
text
.
length
>
0
)
{
_titleFiled
.
text
=
@""
;
}
if
(
_billFiled
.
text
.
length
>
0
)
{
_billFiled
.
text
=
@""
;
}
if
(
_currentIndexPath
)
{
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
}
if
([
self
.
delegate
respondsToSelector
:
@selector
(
clearBoltInformation
)])
{
[
self
.
delegate
clearBoltInformation
];
}
}
#pragma mark - 协议
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
...
...
@@ -245,9 +272,5 @@
}
}
-
(
BOOL
)
textField
:
(
UITextField
*
)
textField
shouldChangeCharactersInRange
:
(
NSRange
)
range
replacementString
:
(
NSString
*
)
string
{
NSLog
(
@"%@"
,
self
.
titleFiled
.
text
);
return
YES
;
}
@end
XFFruit/ViewControllers/Survey/Views/SortMaskView.m
View file @
8956cf5d
...
...
@@ -73,8 +73,10 @@
_currentIndexPath
=
indexPath
;
if
(
indexPath
.
row
==
0
)
{
[
self
.
delegate
getSortValueSelectRow
:
@"asc"
];
}
else
{
}
else
if
(
indexPath
.
row
==
1
)
{
[
self
.
delegate
getSortValueSelectRow
:
@"desc"
];
}
else
{
[
self
.
delegate
getSortValueSelectRow
:
@"none"
];
}
}
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
View file @
8956cf5d
...
...
@@ -43,7 +43,6 @@ typedef enum : NSUInteger {
@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(降序)
...
...
@@ -86,7 +85,7 @@ typedef enum : NSUInteger {
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
NSMutableArray
*
orderArr
=
[
NSMutableArray
array
];
if
(
self
.
orderDirection
.
length
>
0
)
{
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
]
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"lastModified"
;
order
.
direction
=
self
.
orderDirection
;
...
...
@@ -95,7 +94,7 @@ typedef enum : NSUInteger {
id
billObject
=
[
NSNull
null
];
if
(
self
.
billNumberLike
.
length
>
0
)
{
billObject
=
self
.
billNumberLike
;
if
(
self
.
orderDirection
.
length
>
0
)
{
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
]
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"billNumber"
;
order
.
direction
=
self
.
orderDirection
;
...
...
@@ -105,7 +104,7 @@ typedef enum : NSUInteger {
id
stateObject
=
[
NSNull
null
];
if
(
self
.
state
.
length
>
0
&&
!
[
self
.
state
isEqualToString
:
@"none"
])
{
stateObject
=
self
.
state
;
if
(
self
.
orderDirection
.
length
>
0
)
{
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
]
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"state"
;
order
.
direction
=
self
.
orderDirection
;
...
...
@@ -115,13 +114,20 @@ typedef enum : NSUInteger {
id
titleObject
=
[
NSNull
null
];
if
(
self
.
titleLike
.
length
>
0
)
{
titleObject
=
self
.
titleLike
;
if
(
self
.
orderDirection
.
length
>
0
)
{
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
]
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"title"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
if
(
orderArr
.
count
==
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"billNumber"
;
order
.
direction
=
@"desc"
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
NSDictionary
*
dict
=
@{
@"billNumberLike"
:
billObject
,
@"state"
:
stateObject
,
...
...
@@ -159,6 +165,7 @@ typedef enum : NSUInteger {
-
(
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
];
...
...
@@ -167,7 +174,6 @@ typedef enum : NSUInteger {
_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
;
...
...
@@ -179,6 +185,25 @@ typedef enum : NSUInteger {
[
self
.
view
addSubview
:
_maskView
];
}
//检测排序的颜色
-
(
void
)
checkSortBtnColor
{
if
(
self
.
orderDirection
.
length
>
0
)
{
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
}
else
{
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
}
}
-
(
void
)
checkBoltBtnColor
{
if
(
self
.
state
.
length
>
0
||
self
.
billNumberLike
.
length
>
0
||
self
.
titleLike
.
length
>
0
)
{
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
}
else
{
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
}
}
#pragma mark - 确定
-
(
void
)
sureClick
{
[
_boltView
.
titleFiled
resignFirstResponder
];
...
...
@@ -194,19 +219,6 @@ typedef enum : NSUInteger {
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
;
}
...
...
@@ -226,8 +238,8 @@ typedef enum : NSUInteger {
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
1
05
)
withOrderDirection
:
self
.
orderDirection
];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"按时间顺序"
,
@"按时间逆序"
,
nil
];
_sortView
=
[[
SortMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
1
50
)
withOrderDirection
:
self
.
orderDirection
];
_sortView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"按时间顺序"
,
@"按时间逆序"
,
@"默认排序"
,
nil
];
_sortView
.
delegate
=
self
;
[
_maskView
addSubview
:
_sortView
];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
...
...
@@ -252,7 +264,7 @@ typedef enum : NSUInteger {
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
if
(
_boltView
==
nil
)
{
_boltView
=
[[
BoltMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
2
2
4
)
state
:
self
.
state
title
:
self
.
titleLike
bill
:
self
.
billNumberLike
];
_boltView
=
[[
BoltMaskView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
105
,
ScreenSize
.
width
,
2
7
4
)
state
:
self
.
state
title
:
self
.
titleLike
bill
:
self
.
billNumberLike
];
_boltView
.
backgroundColor
=
HexColor
(
@"f8f8f8"
);
_boltView
.
delegate
=
self
;
_boltView
.
dataArr
=
[[
NSMutableArray
alloc
]
initWithObjects
:
@"不限"
,
@"未提交"
,
@"已提交"
,
@"调研中"
,
nil
];
...
...
@@ -272,7 +284,9 @@ typedef enum : NSUInteger {
-
(
void
)
hiddenSortMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_sortBtn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
[
self
checkSortBtnColor
];
// [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if
(
isHide
==
NO
)
{
[
_sortView
removeFromSuperview
];
_sortView
=
nil
;
...
...
@@ -291,7 +305,9 @@ typedef enum : NSUInteger {
}
-
(
void
)
hiddenBoltMaskView
:
(
BOOL
)
isHide
{
currentBtn
=
nil
;
[
_boltBtn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
[
self
checkBoltBtnColor
];
// [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if
(
isHide
==
NO
)
{
[
_boltView
removeFromSuperview
];
_boltView
=
nil
;
...
...
@@ -310,9 +326,12 @@ typedef enum : NSUInteger {
}
#pragma mark - sortDelegate
-
(
void
)
getSortValueSelectRow
:
(
NSString
*
)
state
{
self
.
orderDirection
=
state
;
NSLog
(
@"%@"
,
state
);
if
(
state
.
length
>
0
)
{
self
.
orderDirection
=
state
;
NSLog
(
@"%@"
,
state
);
}
}
#pragma mark - boltDelegate
-
(
void
)
getBoltValueSelectRow
:
(
NSString
*
)
state
{
self
.
state
=
state
;
NSLog
(
@"%@"
,
state
);
...
...
@@ -325,7 +344,18 @@ typedef enum : NSUInteger {
self
.
billNumberLike
=
billNumber
;
NSLog
(
@"%@"
,
billNumber
);
}
-
(
void
)
clearBoltInformation
{
//清空所有条件
if
(
self
.
billNumberLike
.
length
>
0
)
{
self
.
billNumberLike
=
@""
;
}
if
(
self
.
titleLike
.
length
>
0
)
{
self
.
titleLike
=
@""
;
}
if
(
self
.
state
.
length
>
0
)
{
self
.
state
=
@""
;
}
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
...
...
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