Skip to content
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

Trouble setting Card contentView to anything but UILabel #678

Closed
theolof opened this issue Feb 6, 2017 · 2 comments
Closed

Trouble setting Card contentView to anything but UILabel #678

theolof opened this issue Feb 6, 2017 · 2 comments
Assignees

Comments

@theolof
Copy link

theolof commented Feb 6, 2017

Possible regression in 2.4.13 in comparison to 2.4.0:

I cannot set card.contentView = detailView when detailView is a UIView
This makes the layout messed up:
screen shot 2017-02-06 at 14 02 19

The detailView is orange in the screenshot and the card is green. The elements (TextView, TextView, FlatButton) inside detailView are constrained like this:

detailView.addConstraint(NSLayoutConstraint(item: passwordField, attribute: .leading, relatedBy: .equal, toItem: detailView, attribute: .leading, multiplier: 1.0, constant: 8))
detailView.addConstraint(NSLayoutConstraint(item: passwordField, attribute: .trailing, relatedBy: .equal, toItem: detailView, attribute: .trailing, multiplier: 1.0, constant: -8))
detailView.addConstraint(NSLayoutConstraint(item: passwordField, attribute: .centerY, relatedBy: .equal, toItem: detailView, attribute: .centerY, multiplier: 1.0, constant: -80))

Is there a workaround or do you need to change something?

I tried to find a sample that works, but the only one I found doesn't:
screen shot 2017-02-06 at 14 05 45

@daniel-jonathan
Copy link
Member

daniel-jonathan commented Feb 7, 2017

I tried the sample and it should work with the latest Material 2.4.16. If the issue persists, please reopen or create a new issue. Thank you!

@theolof
Copy link
Author

theolof commented Feb 8, 2017

Yes, I got it to work. Had to set the height of the detailView, i.e. detailView.height = 300.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants