Iphone 在contentView后面隐藏UITableView分隔符
我在iPhoneOS3.0中制作了一个分组的UITableView,看起来像左图。结果是OS3.1中的正确映像 imageView位于分隔符下方 我尝试将内容视图放在前面。当tableView采用分组样式时(自己绘制分隔符),分隔符样式的适当性似乎被忽略。更改分隔符颜色将生成字符串结果 谢谢你的帮助 编辑:这是未做任何更改的代码:Iphone 在contentView后面隐藏UITableView分隔符,iphone,cocoa-touch,uitableview,separator,Iphone,Cocoa Touch,Uitableview,Separator,我在iPhoneOS3.0中制作了一个分组的UITableView,看起来像左图。结果是OS3.1中的正确映像 imageView位于分隔符下方 我尝试将内容视图放在前面。当tableView采用分组样式时(自己绘制分隔符),分隔符样式的适当性似乎被忽略。更改分隔符颜色将生成字符串结果 谢谢你的帮助 编辑:这是未做任何更改的代码: static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView deq
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.font = [UIFont boldSystemFontOfSize:18.0];
}
cell.textLabel.text = [[metro.arretDirection objectAtIndex:indexPath.row] name];
NSString* name;
if (indexPath.row == 0) {
name = @"Begining";
}
else if (indexPath.row + 1 == [metro.arretDirection count]) {
name = @"End";
}
else {
if ([[[metro.arretDirection objectAtIndex:indexPath.row] lines] count]== 1) name = @"Little";
else name = @"Big";
}
UIImage* metroImage = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%i%@.png", metro.metroNumber, name]]];
cell.imageView.image = metroImage;
[metroImage release];
return cell;
在单元格上,尝试设置为NO.eg
cell.clipsToBounds=NO
答案其实很简单,只需在单元格中添加一个UIImageView
,将其正确放置,而不是使用内置的imageView。这很奇怪。您能发布相关代码吗?在3.1中,imageView的大小可能缩小了2个像素,因此请将imageView的框架写入日志,然后查看它的说明。还要查看imageView的contentMode
在3.0中是什么,以及它与3.1的比较,还可以尝试imageView的clipsToBounds
属性。甚至可能是imageView的层的masksToBounds
属性(尽管这应该已经设置为否)。