简体   繁体   中英

Overlapping UITableviewCells

In a tableview one cell overlaps the cell displayed under it when initially presented. When you scroll down until the top cell is not longer visible and then scroll back up the cell are ok again. I deactivated the separators with this line:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

The second cell has a view that fill it from top to bottom, that was a border radius. When the cells are initially presented the border is covert.

How can i fix the spacing of the tableviewCells when they are initially loaded? Can i set the z index the second cell, so that the second cell is above the first one?

I finally found that the constraint of the the top cells where causing the trouble. I found a workaround by storing the layout constraint in a property and adjusting the constant of the constraint as needed.

For "Can i set the z index the second cell, so that the second cell is above the first one?"

UITableViewCell is subclass of UIView so in table view delegate use this :

secondCell.layer.zPosition = 1;

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