0

I have cell that contains tableView. I need this tableView to achieve datePicker expand behavior like this:

enter image description here

but instead of it i have this:

enter image description here

My code pretty simple. In both tableViews i set estimatedRowHeight and rowHeight to UITableViewAutomaticDimension (in this situation i had result that second gif show. The expected result (first git) achieved by manually set heightForRowAtIndexPath to specific height value). But i have result that i don't expected.
Also when i run the app i have the following warning:

[Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.

Why this happens? And can get this work by not adding new overhead code (for example, i believe UITableViewAutomaticDimension will correct work if i do some magic with intrinsic size).

P.S. Here is the demo project.

pacification
  • 5,838
  • 4
  • 29
  • 51
  • [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.MainviewHight_Constrain.constant = give your tableview hight [self.view layoutIfNeeded]; } completion:^(BOOL finished){ Isshowsubmenu = NO; }]; set this all in one button click method . – Himanshu Moradiya Nov 19 '16 at 13:09

1 Answers1

2

If you are using UITableViewAutomaticDimension you need to set the constraints of all the elements of your cell from, top, left, bottom, right. If you are not doing do then you will get the warning which you are showing in your question.

Rajat
  • 10,977
  • 3
  • 38
  • 55
  • All constraints have already set before i posted this question. Looks like this is not the reason. – pacification Nov 19 '16 at 14:23
  • @pacification you need to set the constraint from all the 4 sides check this - http://stackoverflow.com/questions/37638550/two-uilabels-on-uitable-with-dynamic-height/37638748#37638748 – Rajat Nov 19 '16 at 16:07