FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Views/TaskSelectionView.m at master · magic-coder/Coding-iOS · GitHub
magic-coder
/
Coding-iOS
Public
forked from
coding/Coding-iOS
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Views
/
TaskSelectionView.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
176 lines (146 loc) · 5.67 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Views
/
TaskSelectionView.m
Copy path
File metadata and controls
176 lines (146 loc) · 5.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//
//
TaskSelectionView.m
//
Coding_iOS
//
//
Created by 张达棣 on 16/12/4.
//
Copyright © 2016年 Coding. All rights reserved.
//
#
define
kfirstRowNum
3
#
import
"
TaskSelectionView.h
"
#
import
"
XHRealTimeBlur.h
"
#
import
"
Coding_NetAPIManager.h
"
#
import
"
ProjectCount.h
"
#
import
"
Projects.h
"
#
import
"
pop.h
"
#
import
"
TaskSelectionCell.h
"
@interface
TaskSelectionView
()<UITableViewDataSource,UITableViewDelegate>
@property
(
nonatomic
,
strong
) XHRealTimeBlur *realTimeBlur;
@property
(
nonatomic
,
strong
) UITableView *tableview;
@property
(
nonatomic
,
strong
) ProjectCount *pCount;
@property
(
nonatomic
,
assign
)
NSInteger
selectNum;
//
选中数据
@end
@implementation
TaskSelectionView
- (
id
)
initWithFrame
:
(CGRect)
frame
items
:
(
NSArray
*)
items
{
self = [
super
initWithFrame:
frame];
if
(self) {
//
Initialization code
self.
items
= items;
self.
pCount
=[ProjectCount
new
];
self.
showStatus
=
NO
;
[
self
setup
];
}
return
self;
}
- (
void
)
refreshMenuDate
{
__weak
typeof
(self) weakSelf = self;
[[Coding_NetAPIManager
sharedManager
]
request_ProjectsCatergoryAndCounts_WithObj:
_pCount
andBlock:
^(ProjectCount *data,
NSError
*error) {
if
(data) {
[weakSelf.pCount
configWithProjects:
data];
[weakSelf.tableview
reloadData
];
}
if
(error)
{
NSLog
(
@"
get count error
"
);
}
}];
}
//
设置属性
- (
void
)
setup
{
self.
backgroundColor
= [UIColor
clearColor
];
_realTimeBlur = [[XHRealTimeBlur
alloc
]
initWithFrame:
self
.bounds];
_realTimeBlur.
clipsToBounds
=
YES
;
_realTimeBlur.
blurStyle
= XHBlurStyleTranslucentWhite;
_realTimeBlur.
showDuration
=
0.1
;
_realTimeBlur.
disMissDuration
=
0.2
;
typeof
(self) __weak weakSelf = self;
_realTimeBlur.
willShowBlurViewcomplted
= ^(
void
) {
POPBasicAnimation *alphaAnimation = [POPBasicAnimation
animationWithPropertyNamed:
kPOPViewAlpha
];
alphaAnimation.
fromValue
= @
0.0
;
alphaAnimation.
toValue
= @
1.0
;
alphaAnimation.
duration
=
0
.
3f
;
[weakSelf.tableview
pop_addAnimation:
alphaAnimation
forKey:
@"
alphaAnimationS
"
];
};
_realTimeBlur.
willDismissBlurViewCompleted
= ^(
void
) {
POPBasicAnimation *alphaAnimation = [POPBasicAnimation
animationWithPropertyNamed:
kPOPViewAlpha
];
alphaAnimation.
fromValue
= @
1.0
;
alphaAnimation.
toValue
= @
0.0
;
alphaAnimation.
duration
=
0
.
2f
;
[weakSelf.tableview
pop_addAnimation:
alphaAnimation
forKey:
@"
alphaAnimationE
"
];
};
_realTimeBlur.
didDismissBlurViewCompleted
= ^(
BOOL
finished) {
[weakSelf
removeFromSuperview
];
};
_realTimeBlur.
hasTapGestureEnable
=
YES
;
_tableview = ({
UITableView *tableview=[[UITableView
alloc
]
initWithFrame:
self
.bounds];
tableview.
backgroundColor
=[UIColor
clearColor
];
tableview.
delegate
=self;
tableview.
dataSource
=self;
[tableview
registerClass:
[TaskSelectionCell
class
]
forCellReuseIdentifier:
kCellIdentifier_TaskSelectionCell
];
tableview.
tableFooterView
=[UIView
new
];
tableview.
separatorStyle
=UITableViewCellSeparatorStyleNone;
tableview.
estimatedRowHeight
=
0
;
tableview.
estimatedSectionHeaderHeight
=
0
;
tableview.
estimatedSectionFooterHeight
=
0
;
tableview;
});
[
self
addSubview:
_tableview];
_tableview.
contentInset
=
UIEdgeInsetsMake
(
15
,
0
,
0
,
0
);
int
contentHeight=
100
;
if
((
kScreen_Height
-
64
)>contentHeight) {
UIView *contentView=[[UIView
alloc
]
initWithFrame:
CGRectMake
(
0
,
64
+contentHeight ,
kScreen_Width
,
kScreen_Height
-
64
-contentHeight)];
contentView.
backgroundColor
=[UIColor
clearColor
];
[
self
addSubview:
contentView];
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer
alloc
]
initWithTarget:
self
action:
@selector
(
didClickedContentView:
)];
[contentView
addGestureRecognizer:
tapGestureRecognizer];
}
}
#
pragma mark
-- event & action
- (
void
)
showMenuAtView
:
(UIView *)
containerView
{
_showStatus=
YES
;
[containerView
addSubview:
self
];
[_realTimeBlur
showBlurViewAtView:
self
];
[_tableview
reloadData
];
}
- (
void
)
dismissMenu
{
UIView *presentView=[[[UIApplication
sharedApplication
].keyWindow
rootViewController
]
view
];
if
([[presentView.subviews
firstObject
]
isMemberOfClass:
NSClassFromString
(
@"
RDVTabBar
"
)]) {
[presentView
bringSubviewToFront:
[presentView.subviews
firstObject
]];
}
_showStatus=
NO
;
[_realTimeBlur
disMiss
];
}
#
pragma mark
-- uitableviewdelegate & datasource
- (
NSInteger
)
numberOfSectionsInTableView
:
(UITableView *)
tableView
{
return
1
;
}
- (
NSInteger
)
tableView
:
(UITableView *)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
_items.
count
;
}
- (UITableViewCell *)
tableView
:
(UITableView *)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
TaskSelectionCell *cell = [tableView
dequeueReusableCellWithIdentifier:
kCellIdentifier_TaskSelectionCell
forIndexPath:
indexPath];
cell.
title
= _items[indexPath.row];
cell.
isSel
= indexPath.
row
==_selectNum;
return
cell;
}
- (CGFloat)
tableView
:
(UITableView *)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
return
((indexPath.
row
==
0
)&&(indexPath.
section
==
1
))||((indexPath.
row
==
0
)&&(indexPath.
section
==
2
))?
30.5
:
50
;
}
- (
void
)
tableView
:
(UITableView *)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
_selectNum=indexPath.
row
;
[
self
dismissMenu
];
_clickBlock
(indexPath.
row
);
[tableView
deselectRowAtIndexPath:
indexPath
animated:
YES
];
}
- (
void
)
didClickedContentView
:
(UIGestureRecognizer *)
sender
{
_closeBlock
();
}
- (
void
)
setItems
:
(
NSArray
*)
items
{
_items = items;
[_tableview
reloadData
];
}
@end
Back
|
FazBrowse Home
|
New Git URL