我已经在IB中设置了UITableView的行分隔符样式和颜色,但是,当表加载分隔线时不可见。自定义UITableViewCell缺少行分隔符
我正在使用具有自定义超类的UITableView CustomTableView
- 这是UITableView
的子类。在这张表中,我也使用了自定义的UITableViewCell
。
我能想到的唯一问题是,如果我没有在我的awakeFromNib
方法中调用'超级'实现 - 但我这样做是不可能的。
任何想法?
EDIT与代码
我的表格单元是如下 - CustomDefaultCell.h> CustomPlainCell.h>的UITableViewCell
CustomDefaultCell.m
- (void)awakeFromNib
{
[super awakeFromNib];
// Called when loaded from a nib.
// Override all default cell behaviour here.
//
}
CustomPlainCell.m
- (void)awakeFromNib
{
[super awakeFromNib];
// Called when loaded from a nib.
// Override all default cell behaviour here.
//
// Normal background view
self.backgroundView = [[UIView alloc] initWithFrame:self.frame];
self.backgroundView.backgroundColor = [UIColor whiteColor];
// Selected background view
self.selectedBackgroundView = [[UIView alloc] init];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
//
// Background gradient
CAGradientLayer *selectedViewGradientLayer = [CAGradientLayer layer];
selectedViewGradientLayer.frame = CGRectMake(1.0f, 0.0f, 320.0f, CGRectGetHeight(self.frame) + 1.0f);
selectedViewGradientLayer.colors = @[(id)[UIColor colorWithHue:0.0f saturation:0.0f brightness:0.57f alpha:1.0f].CGColor, (id)[UIColor grayColor].CGColor];
[self.selectedBackgroundView.layer addSublayer:selectedViewGradientLayer];
}
你使用Quartz来绘制你的内容吗? – 2012-09-09 14:31:26
我有一个.xib文件,相应的.h和.m –
我知道,但是.h和m中有什么? (不要告诉我“里面有代码”!) – 2012-09-09 14:38:39