Skip to content

Commit

Permalink
💄 :: [#1223] 작업자 이름이 길어질 때를 위한 최대 width
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Aug 25, 2024
1 parent c079672 commit ba0f9f1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ final class CreditCollectionViewCell: UICollectionViewCell {
) -> UICollectionViewLayoutAttributes {
setNeedsLayout()
layoutIfNeeded()
let collectionViewWidth = superview?.bounds.width ?? UIScreen.main.bounds.width

let maxWidth = collectionViewWidth * 0.6

let size = contentView.systemLayoutSizeFitting(layoutAttributes.size)
var newFrame = layoutAttributes.frame
newFrame.size = size
newFrame.size = .init(
width: min(maxWidth, size.width),
height: size.height
)
layoutAttributes.frame = newFrame
return layoutAttributes
}
Expand Down

0 comments on commit ba0f9f1

Please sign in to comment.