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

The correct way to use 'sizeThatFits(_:)' #269

Open
winnisx7 opened this issue Dec 19, 2024 · 2 comments
Open

The correct way to use 'sizeThatFits(_:)' #269

winnisx7 opened this issue Dec 19, 2024 · 2 comments

Comments

@winnisx7
Copy link

image image image

I usually use method #1 when I want to calculate the size of a view with a fixed width and maximum height, just like a 'UILabel'.
However, when I tried to do this in flexlayout, the only thing that worked was CGFloat.nan.
Am I doing something wrong? If not, I think I need to modify the logic in the library.

@winnisx7
Copy link
Author

혹시 방법을 알고 계시다면 도움 부탁드립니다. @OhKanghoon

@OhKanghoon
Copy link
Contributor

OhKanghoon commented Dec 20, 2024

yoga 에서는 제약사항에 대한 판단을 YGUndefined 타입으로 하고 있어요. Swift 의 경우.nan 에 해당됩니다.
제약 없이 높이를 계산하고 싶다면 작성해주신 3번 방법을 사용해주시면 됩니다.

참고 자료

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

No branches or pull requests

2 participants