我需要在iOS 7中显示分隔线(与我的图像2相同)。我使用下面的代码中的cellForRowAtIndexPath:ios 7 - uitableviewCell分隔线
UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
separatorLineView.backgroundColor = [UIColor colorWithRed:229/255.0 green:229/255.0 blue:229/255.0 alpha:1.0];
[cell.contentView addSubview:separatorLineView];
UIView *customColorView = [[UIView alloc] init];
customColorView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell_highlighted.png"]];
cell.selectedBackgroundView = customColorView;
cell.backgroundColor=[UIColor clearColor];
//Separation style for iOS7
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
return cell;
我得到的输出如下图:
但我的输出应该像下面的图像两个IOS 6和7:
任何人都可以请帮我怎么做到这一点?谢谢..
Thanks @ A-Live我已经根据你改变了它,仍然得到相同的输出。 – user2786
@ user2786确保您在视图层次结构中具有有效的宽度和顺序。增加了一些代码,如有需要,随时提供详细信息。 –