2009-09-16 40 views
3

我在iPhone OS 3.0中做了一个看起来像左边图像的分组UITableView。结果是OS 3.1中的正确映像。隐藏在contentView后面的UITableView分隔符

的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; 
+0

这很好奇。你能否发布相关的代码? – coneybeare 2009-09-16 05:03:28

回答

1

答案其实很简单,只需在单元格中正确添加UIImageView而不是使用内置的imageView。

1

在小区尝试设置clipsToBounds为NO。例如cell.clipsToBounds = NO;

+0

对不起乔纳森,这是行不通的...... – gcamp 2011-01-02 17:29:29

+0

有可能在3.1中imageView的大小被缩小了2个像素,所以把imageView的框架写到日志中,看看它说了什么。另请参阅imageView的contentMode是什么,以及它如何与3.1比较,也可以尝试imageView的clipsToBounds属性。甚至可能是imageView的图层的“masksToBounds”属性(尽管这应该已经设置为no)。 – 2011-01-02 18:03:12