roberthein / TinyConstraints

Nothing but sugar.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected layouting problem once using with UICollectionViewCell

fullc0de opened this issue · comments

When I used NSLayoutAnchor to fit any view(named, myview) to contentView of UICollectionViewCell by using edges method like the following, myview is not resized but contentView is actually resized to fit to myview.

cell.contentView.addSubview(myview)
myview.edges(to: cell.contentView)

As I mention above, I expected that myview has same size of contentView. On the contrary, a size of contentView is affected by a size of myview.

On the other hand, using NSLayoutConstraint with Visual Format works well.

Is there anything what I don't know about NSLayoutAnchor?

Mmmh 🤔 Let me look into this..
Could you provide a snippet of the actual code?

Hi @fullc0de ,
I believe this issue was caused by different layout priorities between UIKit and TinyConstraints. The UIKit default priority is 1000 and the default of TinyConstraints was 750. I changed this to be the same as in UIKit in version 2.0 of TinyConstraints which I just released. 🚀
I hope this fixes your issue..

Hello, @roberthein
First of all, I'm sorry not to reponse quickly to your request.
Anyway, it works well as I expected. thank you for your work!!

Thank you for pointing it out!