|
7 | 7 | // |
8 | 8 |
|
9 | 9 | #import "AboutViewController.h" |
| 10 | +#import "TitleDisclosureCell.h" |
| 11 | +#import "CodingShareView.h" |
10 | 12 |
|
11 | | -@interface AboutViewController () |
| 13 | +@interface AboutViewController ()<UITableViewDataSource, UITableViewDelegate> |
12 | 14 | @end |
13 | 15 |
|
14 | 16 | @implementation AboutViewController |
15 | 17 |
|
16 | | -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil |
17 | | -{ |
18 | | - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; |
19 | | - if (self) { |
20 | | - // Custom initialization |
21 | | - } |
22 | | - return self; |
23 | | -} |
24 | | - |
25 | | -- (void)viewDidLoad |
26 | | -{ |
| 18 | +- (void)viewDidLoad{ |
27 | 19 | [super viewDidLoad]; |
28 | 20 | // Do any additional setup after loading the view. |
29 | 21 | self.view.backgroundColor = kColorTableSectionBg; |
@@ -99,62 +91,39 @@ - (void)viewDidLoad |
99 | 91 | make.left.right.mas_equalTo(self.view); |
100 | 92 | make.height.mas_equalTo(5*infoLabel.font.pointSize); |
101 | 93 | }]; |
102 | | - |
103 | | - |
104 | | - |
105 | | - |
106 | | -// UILabel *infoLabel1 = [[UILabel alloc] init]; |
107 | | -// infoLabel1.numberOfLines = 0; |
108 | | -// infoLabel1.backgroundColor = [UIColor clearColor]; |
109 | | -// infoLabel1.font = [UIFont systemFontOfSize:12]; |
110 | | -// infoLabel1.textColor = [UIColor colorWithHexString:@"0x666666"]; |
111 | | -// infoLabel1.textAlignment = NSTextAlignmentRight; |
112 | | -// infoLabel1.text = [NSString stringWithFormat:@"官网:\nE-mail:\n微博:\n微信:"]; |
113 | | -// [self.view addSubview:infoLabel1]; |
114 | | -// |
115 | | -// UILabel *infoLabel2 = [[UILabel alloc] init]; |
116 | | -// infoLabel2.numberOfLines = 0; |
117 | | -// infoLabel2.backgroundColor = [UIColor clearColor]; |
118 | | -// infoLabel2.font = [UIFont systemFontOfSize:12]; |
119 | | -// infoLabel2.textColor = [UIColor colorWithHexString:@"0x666666"]; |
120 | | -// infoLabel2.textAlignment = NSTextAlignmentLeft; |
121 | | -// infoLabel2.text = [NSString stringWithFormat:@"https://coding.net \[email protected] \nCoding \n扣钉Coding"]; |
122 | | -// [self.view addSubview:infoLabel2]; |
123 | 94 |
|
| 95 | + UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; |
| 96 | + tableView.scrollEnabled = NO; |
| 97 | + tableView.backgroundColor = [UIColor clearColor]; |
| 98 | + tableView.dataSource = self; |
| 99 | + tableView.delegate = self; |
| 100 | + tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
| 101 | + [tableView registerClass:[TitleDisclosureCell class] forCellReuseIdentifier:kCellIdentifier_TitleDisclosure]; |
| 102 | + [self.view addSubview:tableView]; |
| 103 | + [tableView mas_makeConstraints:^(MASConstraintMaker *make) { |
| 104 | + make.left.right.bottom.equalTo(self.view); |
| 105 | + make.top.equalTo(versionLabel.mas_bottom).offset(44); |
| 106 | + }]; |
| 107 | +} |
124 | 108 |
|
125 | | -// UILabel *copyrightLabel = [[UILabel alloc] init]; |
126 | | -// copyrightLabel.font = [UIFont systemFontOfSize:12]; |
127 | | -// copyrightLabel.textColor = [UIColor colorWithHexString:@"0x666666"]; |
128 | | -// copyrightLabel.textAlignment = NSTextAlignmentCenter; |
129 | | -// copyrightLabel.text = [NSString stringWithFormat:@"Copyright © 2015 Coding.net"]; |
130 | | -// [self.view addSubview:copyrightLabel]; |
131 | | - |
132 | | -// [infoLabel1 mas_makeConstraints:^(MASConstraintMaker *make) { |
133 | | -// make.bottom.equalTo(copyrightLabel.mas_top).offset(-20); |
134 | | -// make.left.mas_equalTo(self.view.mas_left); |
135 | | -// make.right.equalTo(self.view.mas_centerX).offset(-20); |
136 | | -// make.height.mas_equalTo(60); |
137 | | -// }]; |
138 | | -// |
139 | | -// [infoLabel2 mas_makeConstraints:^(MASConstraintMaker *make) { |
140 | | -// make.bottom.equalTo(copyrightLabel.mas_top).offset(-20); |
141 | | -// make.left.mas_equalTo(infoLabel1.mas_right); |
142 | | -// make.right.equalTo(self.view.mas_right); |
143 | | -// make.height.mas_equalTo(60); |
144 | | -// }]; |
145 | | - |
146 | | -// [copyrightLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
147 | | -// make.bottom.equalTo(self.view.mas_bottom).offset(-20); |
148 | | -// make.left.right.equalTo(self.view); |
149 | | -// make.height.mas_equalTo(20); |
150 | | -// }]; |
151 | | - |
| 109 | +#pragma mark Table |
| 110 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ |
| 111 | + return 2; |
152 | 112 | } |
153 | 113 |
|
154 | | -- (void)didReceiveMemoryWarning |
155 | | -{ |
156 | | - [super didReceiveMemoryWarning]; |
157 | | - // Dispose of any resources that can be recreated. |
| 114 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ |
| 115 | + TitleDisclosureCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleDisclosure forIndexPath:indexPath]; |
| 116 | + [cell setTitleStr:indexPath.row == 0? @"去评分": @"推荐 Coding"]; |
| 117 | + [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth]; |
| 118 | + return cell; |
| 119 | +} |
| 120 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ |
| 121 | + [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
| 122 | + if (indexPath.row == 0) {//评分 |
| 123 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kAppReviewURL]]; |
| 124 | + }else{//推荐 Coding |
| 125 | + [CodingShareView showShareViewWithObj:nil]; |
| 126 | + } |
158 | 127 | } |
159 | 128 |
|
160 | 129 | @end |
0 commit comments