0

I am having a problem with ios 13.6 and above.

I am using swift as a programming language. I have a dynamic tableview with constraints which contains another tableview inside it with its own constraints. Entire screen is dynamic in terms of height. My problem is with Inner tableview.

Inner tableview's each row contains 2 textfields and one remove button which removes that particular row. The last row of inner tableview includes add more button which adds another row with same (2 textfields and remove button) contents to inner tableview.

My code is working for iOS 13.5 and below. But since ios 13.6 the inner tableview showing only first 3 rows.

When i debug it i realised that cellForRowAtIndexpath calling only three times no matter what numberOfRows is returning.

I have stuck here since 2 days. This happens only in 13.6 and above.

I thought this might be the issue because of reusing cell. But this issue remains even when I skip reusing part.

1 Answers1

0

I have updated my answer, so check this out: Try to set the tableView's class to this one

final class ContentSizedTableView: UITableView {
    override var contentSize:CGSize {
        didSet {
            invalidateIntrinsicContentSize()
        }
    }
    
    override var intrinsicContentSize: CGSize {
        layoutIfNeeded()
        return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height)
    }
}
  • Tableview inside another tableview is necessary here. Inner table has its frame equal to its contentSize. Inner table's scrolling property is disabled. So only outer tableview scrolls. I tried with your solution but not working. – Kedar Desai Sep 30 '20 at 06:29
  • I just noticed that, I am getting this warning. Is it related to this issue? UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. – Kedar Desai Sep 30 '20 at 07:21
  • The inner table view should scroll? @KedarDesai – Farrukh Makhmudov Sep 30 '20 at 09:13
  • I've updated my answer can you try that? @KedarDesai – Farrukh Makhmudov Sep 30 '20 at 09:18
  • Well I have realised that it was a constraint issue. I had used wrong constraints for dynamic content size for both the tableview. Thanks for your time and feedback. – Kedar Desai Nov 18 '20 at 08:36