隐藏UITableView分隔符后面的contentView [英] Hiding UITableView separator behind the contentView

查看:121
本文介绍了隐藏UITableView分隔符后面的contentView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone OS 3.0中做了一个分组的UITableView,看起来像左图。结果是OS 3.1中的正确图片。

I made a grouped UITableView in iPhone OS 3.0 that looked like the left image. The result is the right image in OS 3.1.

imageView在分隔符下。

The imageView is under the separators.

内容视图在前面。当tableView是分组样式(自己绘制分隔符)时,separatorStyle属性似乎被忽略。更改分隔符颜色会产生字符串结果。

I've tried to put the content view in front. The separatorStyle propriety seems ignored when the tableView is in grouped style (to draw the separator myself). Changing the separator color gives strings results.

感谢您的帮助!

编辑:无更改:

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;


推荐答案

答案其实很简单, code> UIImageView 在单元格中正确的地方,而不是使用内置的imageView。

The answer was actually quite simple, simply add an UIImageView in the cell an place it properly instead of using the built in imageView.

这篇关于隐藏UITableView分隔符后面的contentView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆