我正在使用包含两个部分的分组表,但它仅在 iPhone 5s 及更高版本中被覆盖。它在 4s 和 5 中运行良好。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (![[self.showingArray objectAtIndex:section]boolValue]) {
return 1;
}else{
return [[self.sectionsArray objectAtIndex:section]count];;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"menuCell";
// #warning : Use here your custom cell, instead of POPDCell
POPDCell *cell = nil;
cell = (POPDCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell) {
cell=nil;
[cell removeFromSuperview];
}
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"POPDCell" owner:self options:nil];
if (cell == nil) {
cell = [topLevelObjects objectAtIndex:0];
}
}
这里是5秒截图输出
最佳答案
您需要编写以下代码。
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return HEIGHT;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return HEIGHT;
}
关于ios - 仅在 iPhone5s 和更高版本中覆盖 TableView 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26398924/