2009-09-16 39 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