@@ -90,9 +90,10 @@ - (UIView *)myContentView{
90
90
- (UITableView *)myTableView {
91
91
if (!_myTableView) {
92
92
_myTableView = ({
93
- UITableView *tableView = [[UITableView alloc ] initWithFrame: CGRectZero style: UITableViewStyleGrouped];
93
+ UITableView *tableView = [[UITableView alloc ] initWithFrame: CGRectZero style: UITableViewStylePlain];
94
+ tableView.backgroundColor = [UIColor whiteColor ];
94
95
[tableView registerClass: [UITableViewCell class ] forCellReuseIdentifier: kCellIdentifier_BranchTag ];
95
- tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine ;
96
+ tableView.separatorStyle = UITableViewCellSeparatorStyleNone ;
96
97
tableView.dataSource = self;
97
98
tableView.delegate = self;
98
99
tableView;
@@ -135,6 +136,11 @@ - (void)loadUIElement{
135
136
[self .myContentView addSubview: self .mySegmentedControl];
136
137
137
138
self.mySegmentedControl .frame = CGRectMake (12 , (kCodeBranchTagButton_NavHeight - 30 )/2 , kScreen_Width - 2 *12 , 30 );
139
+ {
140
+ UIView *lineV = [[UIView alloc ] initWithFrame: CGRectMake (0 , kCodeBranchTagButton_NavHeight , kScreen_Width , 1.0 /[UIScreen mainScreen ].scale)];
141
+ lineV.backgroundColor = kColorDDD ;
142
+ [self .myContentView addSubview: lineV];
143
+ }
138
144
self.myContentView .frame = CGRectMake (0 , 0 , kScreen_Width , 0 );
139
145
self.myTableView .frame = CGRectMake (0 , kCodeBranchTagButton_NavHeight , kScreen_Width , 0 );
140
146
@@ -151,7 +157,7 @@ - (void)changeShowing{
151
157
[self loadUIElement ];
152
158
}
153
159
CGPoint origin = [self convertPoint: CGPointMake (0 , CGRectGetHeight (self .bounds)) toView: self .showingContainerView];
154
- CGFloat contentHeight = self.isShowing ? 0 : kCodeBranchTagButton_ContentHeight ;
160
+ CGFloat contentHeight = self.isShowing ? 0 : CGRectGetHeight (self. showingContainerView . bounds ) - origin. y ;
155
161
if (self.isShowing ) {// 隐藏
156
162
self.enabled = NO ;
157
163
[UIView animateWithDuration: 0.3 animations: ^{
@@ -255,26 +261,30 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
255
261
return [self .dataList count ];
256
262
}
257
263
258
- - (CGFloat )tableView : (UITableView *)tableView heightForHeaderInSection : (NSInteger )section {
259
- return 0.5 ;
260
- }
261
-
262
- - (CGFloat )tableView : (UITableView *)tableView heightForFooterInSection : (NSInteger )section {
263
- return 0.5 ;
264
- }
265
-
266
264
- (UITableViewCell *)tableView : (UITableView *)tableView cellForRowAtIndexPath : (NSIndexPath *)indexPath {
267
265
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_BranchTag forIndexPath: indexPath];
268
- cell.textLabel .textColor = [UIColor blackColor ];
269
266
cell.textLabel .font = [UIFont systemFontOfSize: 15 ];
270
-
267
+ cell.backgroundColor = [UIColor whiteColor ];
268
+ cell.tintColor = kColorBrandGreen ;
269
+
271
270
CodeBranchOrTag *curBranchOrTag = [self .dataList objectAtIndex: indexPath.row];
272
271
cell.textLabel .text = curBranchOrTag.name ;
273
272
274
273
if ([curBranchOrTag.name isEqualToString: self .titleStr]) {
275
- cell.backgroundColor = [UIColor colorWithHexString: @" 0xf3f3f3" ];
274
+ cell.textLabel .textColor = kColorBrandGreen ;
275
+ cell.accessoryType = UITableViewCellAccessoryCheckmark;
276
276
}else {
277
- cell.backgroundColor = [UIColor whiteColor ];
277
+ cell.textLabel .textColor = [UIColor blackColor ];
278
+ cell.accessoryType = UITableViewCellAccessoryNone;
279
+ }
280
+
281
+ static NSInteger lineTag = 11011 ;
282
+ if (![cell.contentView viewWithTag: lineTag]) {
283
+ CGFloat lineH = 1.0 /[UIScreen mainScreen ].scale ;
284
+ UIView *lineV = [[UIView alloc ] initWithFrame: CGRectMake (15 , 44 - lineH, kScreen_Width , lineH)];
285
+ lineV.tag = lineTag;
286
+ lineV.backgroundColor = kColorDDD ;
287
+ [cell.contentView addSubview: lineV];
278
288
}
279
289
return cell;
280
290
}
0 commit comments