FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SWRefresh/SWRefreshExample/ViewController.m at master · SolaWing/SWRefresh · GitHub
SolaWing
/
SWRefresh
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SWRefresh
/
SWRefreshExample
/
ViewController.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (55 loc) · 2.07 KB
Breadcrumbs
SWRefresh
/
SWRefreshExample
/
ViewController.m
Copy path
File metadata and controls
69 lines (55 loc) · 2.07 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
//
//
ViewController.m
//
SWRefreshExample
//
//
Created by SolaWing on 15/12/31.
//
Copyright © 2015年 SW. All rights reserved.
//
#
import
"
ViewController.h
"
#
import
"
UIScrollView+SWRefresh.h
"
#
import
"
SWRefreshHeaderView.h
"
#
import
"
SWRefreshFooterView.h
"
#
import
"
SWRefreshBackFooterViewModel.h
"
@interface
ViewController
()<UITableViewDataSource, UITableViewDelegate>
@property
(
nonatomic
,
strong
)
NSMutableDictionary
* dataSource;
@property
(
nonatomic
,
strong
)
NSArray
* keys;
@end
@implementation
ViewController
- (
void
)
viewDidLoad
{
[
super
viewDidLoad
];
_dataSource = [
NSMutableDictionary
new
];
_dataSource[
@"
TableView
"
] =
@"
TableViewController
"
;
_keys = [_dataSource
allKeys
];
self.
automaticallyAdjustsScrollViewInsets
=
YES
;
UITableView* tableView = [[UITableView
alloc
]
initWithFrame:
self
.view.bounds];
tableView.
dataSource
= self;
tableView.
delegate
= self;
[
self
.view
addSubview:
tableView];
}
- (
NSInteger
)
numberOfSectionsInTableView
:
(UITableView *)
tableView
{
return
1
;}
- (
NSInteger
)
tableView
:
(UITableView *)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
_keys.
count
;
}
- (CGFloat)
tableView
:
(UITableView *)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
return
44
;
}
- (UITableViewCell *)
tableView
:
(UITableView *)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
#
define
CellIdentifier
@"
cell
"
UITableViewCell* cell =
[tableView
dequeueReusableCellWithIdentifier:
CellIdentifier];
if
(!cell){
cell = [[UITableViewCell
alloc
]
initWithStyle:
UITableViewCellStyleDefault
reuseIdentifier:
CellIdentifier];
}
cell.
textLabel
.
text
= _keys[indexPath.row];
return
cell;
}
- (
void
)
tableView
:
(UITableView *)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
NSString
* title = _keys[indexPath.row];
NSString
* className = _dataSource[title];
Class
cls =
NSClassFromString
(className);
UIViewController* vc = [cls
new
];
vc.
navigationItem
.
title
= title;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
@end
Back
|
FazBrowse Home
|
New Git URL