Iphone UITableViewCell宽度太窄(分组样式)
我想为我的UITableView定制外观,包括页眉、页脚和单元格的图像。为此,我为表的页眉和页脚返回UIImageView,并将UIImageView设置为单元格的背景视图 问题是单元格的图像比页眉/页脚窄。这似乎是UITableView分组样式的默认行为。我需要一个分组样式,这样在滚动时标题不会与单元格重叠Iphone UITableViewCell宽度太窄(分组样式),iphone,uitableview,Iphone,Uitableview,我想为我的UITableView定制外观,包括页眉、页脚和单元格的图像。为此,我为表的页眉和页脚返回UIImageView,并将UIImageView设置为单元格的背景视图 问题是单元格的图像比页眉/页脚窄。这似乎是UITableView分组样式的默认行为。我需要一个分组样式,这样在滚动时标题不会与单元格重叠 有什么办法解决这个问题吗?对不起,我的英语很差,我可能理解错了。但如果没有错误: 如果找不到正确的解决方案,可以尝试以下方法: 这不是做你想做的事情的最好方法,但这是我能提供的唯一方法 所
有什么办法解决这个问题吗?对不起,我的英语很差,我可能理解错了。但如果没有错误: 如果找不到正确的解决方案,可以尝试以下方法: 这不是做你想做的事情的最好方法,但这是我能提供的唯一方法 所有您需要的是使您的表视图只有一个部分,没有标题。然后,只需将每个原始wich设置为具有不同参数的节的标题:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return <number of all raws in all sections plus number of sections, to make some raws - sections>;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
for (int i = 0; i < (number of sections); i++) {
if (indexPath.raw == i*(number of raws in section i)) return (heigth of header);
}
return (heigth of raw);
}
//Configure cells:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
for (int i = 0; i < (number of sections); i++) if (indexPath.raw == i*(number of raws in section i)) {
//set properties to headers
return cell;
}
//set properties to raws
return cell;
}