New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it doesn't work when content contains dynamic image view #37
Comments
any thought? |
If only width constraint has been set, auto layout engine cannot calculate out a right height for there are not enough informations to determine image view's intrinsic content size (aspect fill mode is not a constraint) |
so what is a solution? height constraint should be applied? |
Yes, that's not avoidable. |
then all the images inside cell should have static height? |
Image views in FDTemplateLayoutCell's demo don't have a width or height constraint because they are using local images, which image sizes are fixed, and will be translated to intrinsic content size constraints. However, your images are downloaded from server and don't know actual sizes before that, so you may try one of:
This is a problem no matter whether you use FDTemplateLayoutCell's or not. The best solution is getting image's size at same time when you get image's url. |
suppose we know the width and height when get image url, where should width and height constraint constant be changed? |
IBOutlet width and height constraints, reset their constant value when you configure cells, maybe look like: // In your cell
- (void)setEntity:(YourEntity *)entity {
self.imageViewWidthConstraint.constant = entity.imageSize.width;
self.imageViewHeightConstraint.constant = entity.imageSize.height;
} |
thanks |
I have one image view inside cell content that loads photo from server.
image view content mode is aspect fill and only width has been defined using autolayout in storyboard.
height should be increased dynamically based on loaded photo size.
constraints for cell content view has been already self-satisfied.
what am I missing?
The text was updated successfully, but these errors were encountered: