标题已经说明了一切。如何在动态表格顶部创建一个静态单元格?我希望能够将它用作我的表格的图例。谢谢。
这是我的 tableView 代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
JointCAD *currentCall = [[xmlParser calls] objectAtIndex:indexPath.row];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"texture3.png"]];
TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UIView *selectionView = [[UIView alloc] initWithFrame:CGRectMake(10, 7, 200, 65)];
[selectionView setBackgroundColor: [UIColor clearColor]];
cell.selectedBackgroundView = selectionView;
}
cell.callTypeLabel.text = currentCall.currentCallType;
cell.locationLabel.text = currentCall.location;
cell.unitsLabel.text = currentCall.units;
cell.stationLabel.text = [@"Station: " stringByAppendingString:currentCall.station];
if ([currentCall.callType isEqualToString:@"F"]) {
cell.imageType = Fire;
}
else {
cell.imageType = EMS;
}
if ([currentCall.county isEqualToString:@"W"]) {
cell.imageType1 = Washington;
}
else {
cell.imageType1 = Clackamas;
}
return cell;
}
最佳答案
这看起来更像是您想要表格的标题,而不是静态单元格。如果我理解您的问题,您需要一个位于顶部且不移动的单元格,而动态部分中的其他单元格按正常情况上下滚动。
如果是这种情况,请使用返回 header View 及其大小的 tableviewdelegate 方法。
如果不是这种情况,那么我不明白你的问题,抱歉。
关于iOS 在动态表格的顶部创建一个静态单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12683735/