proper labels

This commit is contained in:
neon443 committed 2026-04-27 10:38:13 +01:00
1 parent a28913bca9
commit 8c214f1837
5 files changed
+46 -51

No files matched your search

@@ -108,16 +108,26 @@ struct EmojiCollectionView: UIViewRepresentable {
return cell
}
// func collectionView(
// _ collectionView: UICollectionView,
// layout collectionViewLayout: UICollectionViewLayout,
// sizeForItemAt indexPath: IndexPath
// ) -> CGSize {
// let defaultSize = CGSize(width: width, height: width)
//
// guard !hoarder.trie.dict.isEmpty else { return defaultSize }
// let emojiName = pack.items[indexPath.item]
// }
func collectionView(
_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath
) -> CGSize {
let defaultSize = CGSize(width: width, height: width)
guard !hoarder.trie.dict.isEmpty else { return defaultSize }
let emojiName = pack.items[indexPath.item]
let label = UILabel()
label.font = .preferredFont(forTextStyle: .caption1)
label.numberOfLines = 0
label.text = emojiName
let labelHeight = label.sizeThatFits(CGSize(width: width, height: .infinity)).height
print(width+labelHeight)
return CGSize(width: width, height: width+labelHeight)
}
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.