I have seen this being asked here many times but none of the solutions worked for me. Here is my code snippet:
- (UITableViewCell *)tableView:(UITableView *)
I had a similar issue several times. It is very disturbing since it might be anything. From wrong layout constraints to much serious problems. In first case: in UITableViewCell I had
contentView.translatesAutoresizingMaskIntoConstraints = false
After removing this line everytnig went to normal.
In seconds case: I had wrong layout constraint set programmatically:
stackView.topAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 16)
The stack element supposed to be set to Top, not to Bottom. After fixing this line everything went normal.
This behavior in TableView had got me head banging literally. Turns out I had used
@property (weak, nonatomic) NSMutableArray *itemsArray;
instead of
@property (strong, nonatomic) NSMutableArray *itemsArray;
Hope this information helps.
The problem went away when either:
The table view contains many cells (10+),
Each cell has a height of more than 50.
Weird.
I know this question already has an answer, but just for googlers:
In my case the problem was that the views were still in the UITableViewCell
but after scrolling due to a mistake in the frame
property of the views, they went under the next UITableViewCell
and I could not see them.
I think as the accepted answer has clearly said that :
The problem went away when either:
The table view contains many cells (10+),
Each cell has a height of more than 50.
he had similar problem to mine.