简体   繁体   中英

Bottom of Table View (Cell) cut off

There's more content in my Table View , but this cell is getting cut off and not showing more content :

在此处输入图片说明

... So I'm not able to scroll any more, even there is more content.

If I pull up with my finger it shows more content, but then when I let my finger off the cell it goes back to the state show in the image above.

I've tried making sure I set height and width in the Labels and Images in AutoLayout since I thought that might be a problem, but still hasn't fixed it.

Any ideas? Thanks!

UPDATE - Table View structure in Storyboard 在此处输入图片说明

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    id model = self.model[indexPath.row];

    if ([model isKindOfClass:[DBase self]]) {
        return 520;
    }
    else {
        return tableView.rowHeight; // return the default height
    }
}

在此处输入图片说明

I suggest adding height and width constraints to your UITableViewContoller or UITableView in the storyboard.main.

Depending on the size of your device, the UITableView size will remain constant unless you set constraints that will work across all devices.

I was having this problem as well but mine was only cutting off a single cell. I solved it and thought I'd post this here as it may help others in the future

I was using custom cells created from nibs. Some of my cells could change heights so I was also using this:

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 61

I figured out the issue was that I was setting top, left, right and height constraints on my view. I needed to set the bottom constraint as well or else my row height would be way smaller than it should be.

So if you are having this problem check if your row heights aren't smaller than the views that they contain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM