Ios5 分组UITableView';使用图像设置backgroundView时缺少s单元格分隔符
我有一个分组的UITableView和一个自定义UITableViewCell类,我正在为每个单元格添加一个自定义背景图像。但是,当我这样做时,单元格的分隔符不可见。 如果只是将表格样式切换为普通而不是分组,则会显示分隔符 我需要分组表-如何显示分隔符 这是我的密码:Ios5 分组UITableView';使用图像设置backgroundView时缺少s单元格分隔符,ios5,uitableview,Ios5,Uitableview,我有一个分组的UITableView和一个自定义UITableViewCell类,我正在为每个单元格添加一个自定义背景图像。但是,当我这样做时,单元格的分隔符不可见。 如果只是将表格样式切换为普通而不是分组,则会显示分隔符 我需要分组表-如何显示分隔符 这是我的密码: @interface MyCustomTableViewCell : UITableViewCell @end @implementation MyCustomTableViewCell // because I'm loa
@interface MyCustomTableViewCell : UITableViewCell
@end
@implementation MyCustomTableViewCell
// because I'm loading the cell from a xib file
- (id)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self)
{
// Create a background image view.
self.backgroundView = [[UIImageView alloc] init];
}
return self;
}
// MyViewController
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//
// standard cell dequeue + create cell code here
//
//
// Configure the cell background now
//
UIImage *backgroundImage = [UIImage imageNamed:@"odd_row.png"];
if (indexPath.row % 2 == 0)
{
backgroundImage = [UIImage imageNamed:@"even_row.png"];
}
UIImageView *backgroundView = (UIImageView *)cell.backgroundView;
backgroundView.image = backgroundImage;
}
将子视图赋予单元格时,它将自动隐藏分隔符。因此,尝试将分隔线添加到图像本身。因此,它将为您提供分隔符外观
祝您一切顺利。当您为单元格提供子视图时,它将自动隐藏分隔符。因此,尝试将分隔线添加到图像本身。因此,它将为您提供分隔符外观 祝你一切顺利