mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
asdkfjaskjfd uikit...
This commit is contained in:
4 files changed
+14
-20
No files matched your search
@@ -26,7 +26,7 @@ struct EmojiPackDetailView: View {
|
|||||||
var allDownloaded: Bool {
|
var allDownloaded: Bool {
|
||||||
let date = Date.now
|
let date = Date.now
|
||||||
let result = Set(pack.items).isSubset(of: hoarder.downloadedStickers)
|
let result = Set(pack.items).isSubset(of: hoarder.downloadedStickers)
|
||||||
print("hit \(Date.now.timeIntervalSince(date)) \(UUID())")
|
// print("hit \(Date.now.timeIntervalSince(date)) \(UUID())")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
|||||||
label.text = emojiName
|
label.text = emojiName
|
||||||
let labelHeight = label.sizeThatFits(CGSize(width: width, height: .infinity)).height
|
let labelHeight = label.sizeThatFits(CGSize(width: width, height: .infinity)).height
|
||||||
|
|
||||||
print(width+labelHeight+4)
|
print(width, width+labelHeight+4)
|
||||||
|
|
||||||
return CGSize(width: width, height: width+labelHeight+4)
|
return CGSize(width: width, height: width+labelHeight+4)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
|||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
label.numberOfLines = 0
|
label.numberOfLines = 0
|
||||||
label.translatesAutoresizingMaskIntoConstraints = false
|
label.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
contentView.addSubview(label)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
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) {
|
||||||
@@ -34,7 +40,7 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
|||||||
label.text = emoji.UIName
|
label.text = emoji.UIName
|
||||||
|
|
||||||
if label.superview == nil {
|
if label.superview == nil {
|
||||||
stackView.addArrangedSubview(label)
|
contentView.addSubview(label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,10 @@ import UIKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
class PlainEmojiCollectionViewCell: UICollectionViewCell {
|
class PlainEmojiCollectionViewCell: UICollectionViewCell {
|
||||||
let stackView = UIStackView()
|
|
||||||
var hostingController: UIHostingController<StickerPreview>?
|
var hostingController: UIHostingController<StickerPreview>?
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
stackView.axis = .vertical
|
|
||||||
stackView.alignment = .fill
|
|
||||||
stackView.distribution = .fill
|
|
||||||
stackView.spacing = 4
|
|
||||||
|
|
||||||
contentView.addSubview(stackView)
|
|
||||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
stackView.topAnchor.constraint(equalTo: contentView.topAnchor),
|
|
||||||
stackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
|
||||||
stackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
|
||||||
stackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@@ -44,11 +29,14 @@ class PlainEmojiCollectionViewCell: UICollectionViewCell {
|
|||||||
|
|
||||||
let hostingController = UIHostingController(rootView: swiftUIView)
|
let hostingController = UIHostingController(rootView: swiftUIView)
|
||||||
self.hostingController = hostingController
|
self.hostingController = hostingController
|
||||||
self.stackView.insertArrangedSubview(hostingController.view, at: 0)
|
contentView.addSubview(hostingController.view)
|
||||||
|
|
||||||
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
hostingController.view.heightAnchor.constraint(equalTo: hostingController.view.widthAnchor)
|
hostingController.view.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
|
hostingController.view.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
|
hostingController.view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||||
|
hostingController.view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||