2021-02-23 15:14:10 +01:00
|
|
|
//
|
|
|
|
// PickServerCategoryCollectionViewCell.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by BradGao on 2021/2/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
class PickServerCategoryCollectionViewCell: UICollectionViewCell {
|
|
|
|
|
2021-03-06 07:46:04 +01:00
|
|
|
var observations = Set<NSKeyValueObservation>()
|
|
|
|
|
2021-02-23 15:14:10 +01:00
|
|
|
var categoryView: PickServerCategoryView = {
|
|
|
|
let view = PickServerCategoryView()
|
|
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
return view
|
|
|
|
}()
|
|
|
|
|
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() {
|
|
|
|
contentView.addSubview(categoryView)
|
|
|
|
|
|
|
|
NSLayoutConstraint.activate([
|
|
|
|
categoryView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
|
|
|
categoryView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
|
|
|
categoryView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 10),
|
|
|
|
contentView.bottomAnchor.constraint(equalTo: categoryView.bottomAnchor, constant: 10),
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|