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

45 lines
1.3 KiB
Swift
Raw Normal View History

2021-03-25 08:56:17 +01:00
//
// CustomEmojiPickerHeaderCollectionReusableView.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021-3-24.
//
import UIKit
import MastodonAsset
import MastodonLocalization
2021-03-25 08:56:17 +01:00
final class CustomEmojiPickerHeaderCollectionReusableView: UICollectionReusableView {
2021-06-29 10:41:58 +02:00
let titleLabel: UILabel = {
2021-03-25 08:56:17 +01:00
let label = UILabel()
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 12, weight: .bold))
label.textColor = Asset.Colors.Label.secondary.color
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
_init()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
_init()
}
}
extension CustomEmojiPickerHeaderCollectionReusableView {
private func _init() {
2021-06-29 10:41:58 +02:00
titleLabel.translatesAutoresizingMaskIntoConstraints = false
addSubview(titleLabel)
2021-03-25 08:56:17 +01:00
NSLayoutConstraint.activate([
2021-06-29 10:41:58 +02:00
titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: 20),
titleLabel.leadingAnchor.constraint(equalTo: readableContentGuide.leadingAnchor),
titleLabel.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor),
titleLabel.bottomAnchor.constraint(equalTo: bottomAnchor),
2021-03-25 08:56:17 +01:00
])
}
}