当我增加UITableViewCell
的大小时,节标题样式会变得混乱。我正在使用的代码是在" How to set the width of a cell in a UITableView in grouped style"如下:
我继承自UITableViewCell
并创建了这个类:
@implementation UITableViewCellHistory {
}
-(bool) isIPAD
{
return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
}
- (void)setFrame:(CGRect)frame {
if ([self isIPAD])
{
NSInteger inset = 40;
frame.origin.y += inset;
frame.size.height -= 2 * inset;
[super setFrame:frame];
}
}
@end
然后在我的班级中使用表格视图我已经使用上面的类作为我的单元格:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == [data numberOfDaysWithData])
{
NSAssert([data hasMore], @"how come we have more sections than days when more is low?");
UITableViewCell *cell = [[UITableViewCellHistory alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
但是当我进一步增加填充的大小时,tableview中的标题会被行重叠。我错过了什么吗?