我有一個應用程序加載到一個tableview的動態數據。只有一個項目時(因此只有一個單元格)。爲了確保該UITableViewCellSeperator沒有顯示出來的這一個項目我使用這個代碼:UITableViewCellSeperator出現問題後彈出堆棧
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return 0.01f;
}
可正常工作和這裏是我的手機看起來像:
由於你可以看到這個預期的工作,沒有細胞分離器。
當我選擇單元格並顯示我的詳細信息視圖,然後點擊後退按鈕時,單元格出於某種原因添加了分隔符。這裏是細胞看起來像有一次我在棧中向後導航:
你會發現,分隔符是現在比標準隔板寬。如果我的tableview中有多個單元格,那麼tableview中的最後一個單元格的行爲也是一樣的。
當我刪除上述方法,問題是固定的,但現在我的tableview有一個TON的額外分隔符爲空單元格。有更好的解決方案嗎?
這裏是我的cellForRowAtIndexPath方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"searchCell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.backgroundColor = [UIColor PFBlack];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.font = [MuseoSans font500WithSize:16.0f];
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.text = @"Current Location";
return cell;
}
任何想法是什麼原因造成的問題?或者我做錯了什麼?謝謝!
你找到任何解決這個問題? – kukudas