mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
proper labels
This commit is contained in:
5 files changed
+46
-51
No files matched your search
@@ -53,8 +53,6 @@
|
|||||||
A97BFFBD2F9E6092000441E5 /* EmptyEmojiPackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBB2F9E6092000441E5 /* EmptyEmojiPackView.swift */; };
|
A97BFFBD2F9E6092000441E5 /* EmptyEmojiPackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBB2F9E6092000441E5 /* EmptyEmojiPackView.swift */; };
|
||||||
A97BFFBF2F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */; };
|
A97BFFBF2F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */; };
|
||||||
A97BFFC02F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */; };
|
A97BFFC02F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */; };
|
||||||
A97BFFC22F9E7F18000441E5 /* EmojiCollectionFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFC12F9E7F10000441E5 /* EmojiCollectionFlowLayout.swift */; };
|
|
||||||
A97BFFC32F9E7F18000441E5 /* EmojiCollectionFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A97BFFC12F9E7F10000441E5 /* EmojiCollectionFlowLayout.swift */; };
|
|
||||||
A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
|
A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
|
||||||
A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
A986A6C12EB6595F00B6E0FA /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
||||||
@@ -214,7 +212,6 @@
|
|||||||
A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPreview.swift; sourceTree = "<group>"; };
|
A9773C2E2EA54AF000F3B753 /* StickerPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPreview.swift; sourceTree = "<group>"; };
|
||||||
A97BFFBB2F9E6092000441E5 /* EmptyEmojiPackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyEmojiPackView.swift; sourceTree = "<group>"; };
|
A97BFFBB2F9E6092000441E5 /* EmptyEmojiPackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyEmojiPackView.swift; sourceTree = "<group>"; };
|
||||||
A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCollectionViewCell.swift; sourceTree = "<group>"; };
|
A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
A97BFFC12F9E7F10000441E5 /* EmojiCollectionFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCollectionFlowLayout.swift; sourceTree = "<group>"; };
|
|
||||||
A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
A986A6C62EB659E000B6E0FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
A986A6C62EB659E000B6E0FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
A986A6C72EB659E000B6E0FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
A986A6C72EB659E000B6E0FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
@@ -432,7 +429,6 @@
|
|||||||
A94F3E642F9E385300FA6995 /* CollectionView */ = {
|
A94F3E642F9E385300FA6995 /* CollectionView */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
A97BFFC12F9E7F10000441E5 /* EmojiCollectionFlowLayout.swift */,
|
|
||||||
A917BACD2F9B787B008DB31E /* EmojiCollectionView.swift */,
|
A917BACD2F9B787B008DB31E /* EmojiCollectionView.swift */,
|
||||||
A917BAD02F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift */,
|
A917BAD02F9B7B68008DB31E /* PlainEmojiCollectionViewCell.swift */,
|
||||||
A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */,
|
A97BFFBE2F9E745C000441E5 /* EmojiCollectionViewCell.swift */,
|
||||||
@@ -696,7 +692,6 @@
|
|||||||
A9A7A4452F68360900BB84C6 /* Pagination.swift in Sources */,
|
A9A7A4452F68360900BB84C6 /* Pagination.swift in Sources */,
|
||||||
A9104C802EB4022500D160EA /* MSSticker.swift in Sources */,
|
A9104C802EB4022500D160EA /* MSSticker.swift in Sources */,
|
||||||
A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */,
|
A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */,
|
||||||
A97BFFC32F9E7F18000441E5 /* EmojiCollectionFlowLayout.swift in Sources */,
|
|
||||||
A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */,
|
A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */,
|
||||||
A97BFFBC2F9E6092000441E5 /* EmptyEmojiPackView.swift in Sources */,
|
A97BFFBC2F9E6092000441E5 /* EmptyEmojiPackView.swift in Sources */,
|
||||||
A957C1772ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
A957C1772ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
||||||
@@ -820,7 +815,6 @@
|
|||||||
A97BFFC02F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */,
|
A97BFFC02F9E745C000441E5 /* EmojiCollectionViewCell.swift in Sources */,
|
||||||
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */,
|
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */,
|
||||||
A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
||||||
A97BFFC22F9E7F18000441E5 /* EmojiCollectionFlowLayout.swift in Sources */,
|
|
||||||
A921C2E02ED067BB00E57B1A /* WelcomeView.swift in Sources */,
|
A921C2E02ED067BB00E57B1A /* WelcomeView.swift in Sources */,
|
||||||
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
||||||
A9A7A44F2F68383900BB84C6 /* GiphyImages.swift in Sources */,
|
A9A7A44F2F68383900BB84C6 /* GiphyImages.swift in Sources */,
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// EmojiCollectionFlowLayout.swift
|
|
||||||
// StickerSlack
|
|
||||||
//
|
|
||||||
// Created by neon443 on 26/04/2026.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
class EmojiCollectionFlowLayout: NSObject, UICollectionViewDelegateFlowLayout {
|
|
||||||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
|
||||||
let emojiName = pack
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -108,16 +108,26 @@ struct EmojiCollectionView: UIViewRepresentable {
|
|||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
// func collectionView(
|
func collectionView(
|
||||||
// _ collectionView: UICollectionView,
|
_ collectionView: UICollectionView,
|
||||||
// layout collectionViewLayout: UICollectionViewLayout,
|
layout collectionViewLayout: UICollectionViewLayout,
|
||||||
// sizeForItemAt indexPath: IndexPath
|
sizeForItemAt indexPath: IndexPath
|
||||||
// ) -> CGSize {
|
) -> CGSize {
|
||||||
// let defaultSize = CGSize(width: width, height: width)
|
let defaultSize = CGSize(width: width, height: width)
|
||||||
//
|
|
||||||
// guard !hoarder.trie.dict.isEmpty else { return defaultSize }
|
guard !hoarder.trie.dict.isEmpty else { return defaultSize }
|
||||||
// let emojiName = pack.items[indexPath.item]
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,13 +10,30 @@ import UIKit
|
|||||||
|
|
||||||
class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
|
let spacer = UIView()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
|
contentView.addSubview(spacer)
|
||||||
|
spacer.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
label.font = .preferredFont(forTextStyle: .caption1)
|
label.font = .preferredFont(forTextStyle: .caption1)
|
||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
|
label.numberOfLines = 0
|
||||||
contentView.addSubview(label)
|
contentView.addSubview(label)
|
||||||
|
label.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
spacer.topAnchor.constraint(equalTo: topAnchor),
|
||||||
|
spacer.bottomAnchor.constraint(equalTo: label.topAnchor),
|
||||||
|
spacer.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||||
|
spacer.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||||
|
|
||||||
|
label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
|
label.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||||
|
label.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@@ -33,20 +50,6 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
|||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSubviews() {
|
|
||||||
super.layoutSubviews()
|
|
||||||
|
|
||||||
label.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
label.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
|
||||||
label.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
|
||||||
label.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
|
|
||||||
])
|
|
||||||
|
|
||||||
// label.frame = contentView.bounds
|
|
||||||
contentView.bringSubviewToFront(label)
|
|
||||||
}
|
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
label.text = nil
|
label.text = nil
|
||||||
|
|||||||
@@ -47,12 +47,15 @@ class PlainEmojiCollectionViewCell: UICollectionViewCell {
|
|||||||
self.contentView.addSubview(hostingController.view)
|
self.contentView.addSubview(hostingController.view)
|
||||||
|
|
||||||
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate(
|
||||||
hostingController.view.topAnchor.constraint(equalTo: contentView.topAnchor),
|
[
|
||||||
hostingController.view.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
hostingController.view.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
hostingController.view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
// hostingController.view.bottomAnchor.constraint(equalTo: contentView.topAnchor, ),
|
||||||
hostingController.view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
|
hostingController.view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||||
])
|
hostingController.view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||||
|
hostingController.view.heightAnchor.constraint(equalTo: hostingController.view.widthAnchor)
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||