2021-02-23 15:14:10 +01:00
|
|
|
//
|
|
|
|
// PickServerCategoryCollectionViewCell.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by BradGao on 2021/2/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
class PickServerCategoryCollectionViewCell: UICollectionViewCell {
|
2022-01-04 11:30:21 +01:00
|
|
|
|
2021-03-06 07:46:04 +01:00
|
|
|
var observations = Set<NSKeyValueObservation>()
|
|
|
|
|
2022-01-04 11:30:21 +01:00
|
|
|
var categoryView = PickServerCategoryView()
|
2021-02-23 15:14:10 +01:00
|
|
|
|
2021-03-06 07:46:04 +01:00
|
|
|
override func prepareForReuse() {
|
|
|
|
super.prepareForReuse()
|
|
|
|
observations.removeAll()
|
2021-02-23 15:14:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
override init(frame: CGRect) {
|
|
|
|
super.init(frame: .zero)
|
|
|
|
configure()
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
super.init(coder: coder)
|
|
|
|
configure()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension PickServerCategoryCollectionViewCell {
|
|
|
|
private func configure() {
|
2022-01-04 11:30:21 +01:00
|
|
|
backgroundColor = .clear
|
2021-02-23 15:14:10 +01:00
|
|
|
|
2022-01-04 11:30:21 +01:00
|
|
|
categoryView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
contentView.addSubview(categoryView)
|
2021-02-23 15:14:10 +01:00
|
|
|
NSLayoutConstraint.activate([
|
2022-01-04 11:30:21 +01:00
|
|
|
categoryView.topAnchor.constraint(equalTo: contentView.topAnchor),
|
2021-02-23 15:14:10 +01:00
|
|
|
categoryView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
|
|
|
categoryView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
2022-01-04 11:30:21 +01:00
|
|
|
contentView.bottomAnchor.constraint(equalTo: categoryView.bottomAnchor),
|
2021-02-23 15:14:10 +01:00
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|