Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answerthis answer, which is very detailed and helpful.

However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath .

My cell currently only has one label in itscontentView , with constraints set to pin all the label edges to thecontentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell inheightForRowAtIndexPath using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful.

However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath .

My cell currently only has one label in itscontentView , with constraints set to pin all the label edges to thecontentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell inheightForRowAtIndexPath using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful.

However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath .

My cell currently only has one label in itscontentView , with constraints set to pin all the label edges to thecontentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell inheightForRowAtIndexPath using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

AutoLayout constraints to UITableViewCell contentView not respected
Source Link

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful. 

However, the maximum width for the label is not being calculated correctly in heightForRowAtIndexPathheightForRowAtIndexPath .

My cell currently only has one label in its contentViewcontentView , with constraints set to pin all the label edges to the contentViewcontentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell in heightForRowheightForRowAtIndexPath using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidthlabel.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful. However, the maximum width for the label is not being calculated correctly in heightForRowAtIndexPath.

My cell currently only has one label in its contentView, with constraints set to pin all the label edges to the contentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell in heightForRow using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful. 

However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath .

My cell currently only has one label in itscontentView , with constraints set to pin all the label edges to thecontentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell inheightForRowAtIndexPath using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here

Source Link
adamF
  • 1.1k
  • 2
  • 11
  • 23

AutoLayout constraints to UITableViewCell contentView not respected

I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful. However, the maximum width for the label is not being calculated correctly in heightForRowAtIndexPath.

My cell currently only has one label in its contentView, with constraints set to pin all the label edges to the contentView edges. Here's what I have in IB enter image description here

The cell size is being calculated with an offscreen cell in heightForRow using

CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];

During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

enter image description here