-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.m
More file actions
86 lines (60 loc) · 2.43 KB
/
Copy pathViewController.m
File metadata and controls
86 lines (60 loc) · 2.43 KB
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
//
// ViewController.m
// STTest
//
// Created by 刘敏 on 16/5/30.
// Copyright © 2016年 深圳市轩腾华兴科技开发有限公司. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, weak) UITableView *tableView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setNavBarTitle:@"详情"];
UITableView *tableView = [[UITableView alloc] initWithFrame:MAINSCREEN style:UITableViewStylePlain];
_tableView = tableView;
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
//校正滚动区域
[self resetScrollView:_tableView tabBar:NO];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 25;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 48.0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleGray;
[cell.textLabel setFont:[UIFont systemFontOfSize:16.0]];
[cell.textLabel setTextColor:[UIColor blackColor]];
cell.detailTextLabel.minimumScaleFactor = 0.6f;
cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
[cell.detailTextLabel setFont:[UIFont systemFontOfSize:15.0]];
[cell.detailTextLabel setTextColor:[UIColor lightGrayColor]];
}
cell.textLabel.text = @"你好";
return cell;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
ViewController *VC = [[ViewController alloc] init];
[self.navigationController pushViewController:VC animated:YES];
}
@end