我有一个UITableView
已设置属性Grouped
.它看起来像这样,边缘呈圆形。这很棒。
当我开始滚动UITabelView
圆边消失了,看起来像这样:
圆边消失了!
我应该如何进行以及当我滚动时UITableView
上下圆边是否像第一张图片一样保留?
所问的相关代码:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [nameCatalog count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.backgroundView.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.opaque = NO;
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.highlightedTextColor = [UIColor whiteColor];
cell.textLabel.font = [UIFont boldSystemFontOfSize:18];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.opaque = NO;
cell.detailTextLabel.textColor = [UIColor whiteColor];
cell.detailTextLabel.highlightedTextColor = [UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:14];
}
[[cell textLabel] setText:[[nameCatalog objectAtIndex:indexPath.row] valueForKey:@"name"]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *escapedString = [[[nameCatalog objectAtIndex:indexPath.row] valueForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url=[NSURL URLWithString:escapedString];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[self.view addSubview:webView];
[self.navigationController pushViewController:webView animated:YES];
[webView setHidden:NO];
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc]
initWithTitle:@"Retour" style:UIBarButtonItemStyleBordered target:self action:@selector(tableRetour:)];
self.navigationItem.leftBarButtonItem = infoButton;
[self.view addSubview:webView];
}
这是因为在第一张图片中,您看到分组 tableView 中的顶行是圆角的,但只有顶行和底行是这样圆角的,所以当您滚动时,您会看到中间行,这是正常的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)