Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

UITableView's cells don't shift each other - overlapping instead ?!

$
0
0

I've faced really annoying problem

Let's say I have layout which consists of UITableView
Table gets populated with custom cells (see image 1)
https://s18.postimg.org/d5hh4tzxx/image_1.png

Custom cell basically consists of view and another tableView.
Size of second table can vary depending on its content. Second table's cells are custom as well.

Important thing to note is second table view is not scrollable. That is it, if table has only one cell so be it, if it has 4 - it must display all of them without scrolling (see image 2)
https://s18.postimg.org/7vcidjfp1/image_2.png

The problem itself is master tableView (first one) behaves wrong: it doesn't want to arrange cells properly, cells are overlapping instead. Also I've noticed that last cell gets truncated for some reason. I'm able to see truncated part only when I pull table up, but UITableView bounce effect comes into play and whole table returns to its state. (see image 3)
https://s18.postimg.org/mskzejsxh/image_3.png

What I've tried so far:
- in ViewController method ViewDidLoad (controller that owns master table view) added following lines of code:

... DetailsTableView.RowHeight = UITableView.AutomaticDimension; DetailsTableView.EstimatedRowHeight = 545; ...

  • I believe that I've configured AutoLayout properly: both master table view and table view which nested in custom cell have vertical margins
  • In second custom cell's LayoutSubviews method I added following lines of code:

var contentSizeFrame = tableView.Frame; contentSizeFrame.Height = tableView.ContentSize.Height; tableView.Frame = contentSizeFrame;

I'm banging my head against the wall for two days already, so any help will be appreciated !!!


Viewing all articles
Browse latest Browse all 204402

Trending Articles