我在 iPhone OS 3.0 中制作了一个分组 UITableView,如下图所示。结果是 OS 3.1 中的正确图像。
imageView 位于分隔符下方。
我尝试将内容视图放在前面。当 tableView 处于分组样式时(我自己绘制分隔符),separatorStyle 属性似乎被忽略。更改分隔符颜色会给出字符串结果。
感谢您的帮助!
编辑:这是未进行任何更改的代码:
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;
在单元格上尝试设置剪辑到边界 http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/clipsToBounds到NO。例如cell.clipsToBounds = NO;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)