-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathViewController.m
107 lines (91 loc) · 3.11 KB
/
ViewController.m
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
//
// ViewController.m
// MYCoreText_Example
//
// Created by 孟遥 on 2017/2/17.
// Copyright © 2017年 mengyao. All rights reserved.
//
#import "ViewController.h"
#import "ImageViewController.h"
#import "LinksViewController.h"
#import "KeywordViewController.h"
#import "DetailViewController.h"
#import "XibViewController.h"
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *munesArray;
@end
@implementation ViewController
- (NSArray *)munesArray
{
if (!_munesArray) {
_munesArray = @[@"只展示图片/表情,其他链接不展示",@"只展示链接,其他不展示",@"只展示关键字,其他不展示",@"最复杂的情况,所有特性都展示",@"xib情况"];
}
return _munesArray;
}
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.rowHeight = 80;
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
}
return _tableView;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"使用场景列表";
[self.view addSubview:self.tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.munesArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
cell.textLabel.text = self.munesArray[indexPath.row];
cell.textLabel.textColor = [UIColor redColor];
cell.textLabel.font = [UIFont systemFontOfSize:18.f weight:1];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
switch (indexPath.row) {
case 0:
{
ImageViewController *imageVc = [[ImageViewController alloc]init];
[self.navigationController pushViewController:imageVc animated:YES];
}
break;
case 1:
{
LinksViewController *imageVc = [[LinksViewController alloc]init];
[self.navigationController pushViewController:imageVc animated:YES];
}
break;
case 2:
{
KeywordViewController *imageVc = [[KeywordViewController alloc]init];
[self.navigationController pushViewController:imageVc animated:YES];
}
break;
case 3:
{
DetailViewController *imageVc = [[DetailViewController alloc]init];
[self.navigationController pushViewController:imageVc animated:YES];
}
break;
case 4:
{
XibViewController *xib = [XibViewController new];
[self.navigationController pushViewController:xib animated:YES];
}
default:
break;
}
}
@end