> On 24 Feb 2015, at 16:44, Aaron Lewis <the.warl0ck.1...@gmail.com> wrote:
> 
> Can someone please take a look at this?
> 
> http://stackoverflow.com/questions/28690947/why-is-this-uiimage-and-uilabel-collapsed
> 
> In short words, the UILabel is invisible when I use a image in the 
> UIImageView.
> It works if I only set backgroundColor.
> 
> I already add a constraint on it .. I couldn't really tell why.
> 
> —

1) don’t add to the cell, add to the cell’s contentView (see the documentation 
on UITableViewCell)
2) your vertical layout is ambiguous, almost always the case when something 
‘disappears’. The label has an intrinsicContentSize, the image has one too 
because you have an image set into it. They both have the same default 750 
content compression resistance. The cell is a fixed height (unless you’re using 
auto-height cells in which case this shouldn’t be happening) so one or other of 
them loses out. In your case the label loses out and its height goes to zero 
(you could see all this in the debugger by the way). 

If you drop the content compression resistance in the vertical direction of the 
uiimage from 750 to 749, or less, then the label should get its height and the 
image view should get what’s left. 

And the comment on StackOverflow that you are setting up the views every time 
you dequeue the cell is accurate. 

And you could use Interface Builder for this too which is usually easier. 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to