mastodon-ios/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/EmojiPicker/CustomEmojiPickerItemCollec...

57 lines
1.3 KiB
Swift
Raw Normal View History

2021-03-25 08:56:17 +01:00
//
// CustomEmojiPickerItemCollectionViewCell.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021-3-24.
//
import UIKit
2021-07-23 13:10:27 +02:00
import SDWebImage
2021-03-25 08:56:17 +01:00
final class CustomEmojiPickerItemCollectionViewCell: UICollectionViewCell {
static let itemSize = CGSize(width: 44, height: 44)
2021-06-29 10:41:58 +02:00
2021-07-23 13:10:27 +02:00
let emojiImageView: SDAnimatedImageView = {
let imageView = SDAnimatedImageView()
2021-03-25 08:56:17 +01:00
imageView.contentMode = .scaleAspectFit
imageView.layer.masksToBounds = true
return imageView
}()
override var isHighlighted: Bool {
didSet {
emojiImageView.alpha = isHighlighted ? 0.5 : 1.0
}
}
2021-06-29 10:41:58 +02:00
override func prepareForReuse() {
super.prepareForReuse()
}
2021-03-25 08:56:17 +01:00
override init(frame: CGRect) {
super.init(frame: frame)
_init()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
_init()
}
}
extension CustomEmojiPickerItemCollectionViewCell {
private func _init() {
emojiImageView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(emojiImageView)
emojiImageView.pinToParent()
isAccessibilityElement = true
accessibilityTraits = .button
accessibilityHint = "emoji"
2021-03-25 08:56:17 +01:00
}
}