FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Controllers/ForkTreeViewController.m at master · jp928/Coding-iOS · GitHub
jp928
/
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
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
ForkTreeViewController.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
98 lines (86 loc) · 3.48 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
ForkTreeViewController.m
Copy path
File metadata and controls
98 lines (86 loc) · 3.48 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
//
//
ForkTreeViewController.m
//
Coding_iOS
//
//
Created by Ease on 15/9/18.
//
Copyright (c) 2015年 Coding. All rights reserved.
//
#
import
"
ForkTreeViewController.h
"
#
import
"
ODRefreshControl.h
"
#
import
"
Coding_NetAPIManager.h
"
#
import
"
ForkTreeCell.h
"
#
import
"
NProjectViewController.h
"
@interface
ForkTreeViewController
()<UITableViewDataSource, UITableViewDelegate>
@property
(
assign
,
nonatomic
)
BOOL
isLoading;
@property
(
strong
,
nonatomic
)
NSArray
*forkList;
@property
(
strong
,
nonatomic
) UITableView *myTableView;
@property
(
strong
,
nonatomic
) ODRefreshControl *myRefreshControl;
@end
@implementation
ForkTreeViewController
- (
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self.
title
=
@"
Fork项目的人
"
;
_myTableView = ({
UITableView *tableView = [[UITableView
alloc
]
initWithFrame:
self
.view.bounds
style:
UITableViewStylePlain];
tableView.
backgroundColor
= [UIColor
clearColor
];
tableView.
delegate
= self;
tableView.
dataSource
= self;
tableView.
separatorStyle
= UITableViewCellSeparatorStyleNone;
[tableView
registerClass:
[ForkTreeCell
class
]
forCellReuseIdentifier:
kCellIdentifier_ForkTreeCell
];
tableView.
sectionIndexBackgroundColor
= [UIColor
clearColor
];
tableView.
sectionIndexTrackingBackgroundColor
= [UIColor
clearColor
];
tableView.
sectionIndexColor
=
kColor666
;
[
self
.view
addSubview:
tableView];
[tableView
mas_makeConstraints:
^(MASConstraintMaker *make) {
make.
edges
.
equalTo
(self.
view
);
}];
tableView;
});
_myRefreshControl = [[ODRefreshControl
alloc
]
initInScrollView:
self
.myTableView];
[_myRefreshControl
addTarget:
self
action:
@selector
(
refresh
)
forControlEvents:
UIControlEventValueChanged];
[
self
refresh
];
}
- (
void
)
refresh
{
if
(_isLoading) {
return
;
}
if
(!_forkList) {
[
self
.view
beginLoading
];
}
__weak
typeof
(self) weakSelf = self;
weakSelf.
isLoading
=
YES
;
[[Coding_NetAPIManager
sharedManager
]
request_ForkTreeWithOwner:
_project_owner_user_name
project:
_project_name
andBlock:
^(
id
data,
NSError
*error) {
weakSelf.
isLoading
=
NO
;
[weakSelf.myRefreshControl
endRefreshing
];
[weakSelf.view
endLoading
];
if
(data) {
weakSelf.
forkList
= data;
[weakSelf.myTableView
reloadData
];
}
}];
}
#
pragma mark
T
- (
NSInteger
)
numberOfSectionsInTableView
:
(UITableView *)
tableView
{
return
1
;
}
- (
NSInteger
)
tableView
:
(UITableView *)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
_forkList.
count
;
}
- (UITableViewCell *)
tableView
:
(UITableView *)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
ForkTreeCell *cell = [tableView
dequeueReusableCellWithIdentifier:
kCellIdentifier_ForkTreeCell
forIndexPath:
indexPath];
cell.
project
= _forkList[indexPath.row];
[tableView
addLineforPlainCell:
cell
forRowAtIndexPath:
indexPath
withLeftSpace:
kPaddingLeftWidth
];
return
cell;
}
- (CGFloat)
tableView
:
(UITableView *)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
return
[ForkTreeCell
cellHeight
];
}
- (
void
)
tableView
:
(UITableView *)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
[tableView
deselectRowAtIndexPath:
indexPath
animated:
YES
];
Project *pro = _forkList[indexPath.row];
pro.
owner_user_name
= pro.
owner
.
global_key
;
NProjectViewController *vc = [NProjectViewController
new
];
vc.
myProject
= pro;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
@end
Back
|
FazBrowse Home
|
New Git URL