2021-02-23 15:14:10 +01:00
|
|
|
//
|
|
|
|
// PickServerCategoryView.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by BradGao on 2021/2/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import MastodonSDK
|
|
|
|
|
|
|
|
class PickServerCategoryView: UIView {
|
|
|
|
|
|
|
|
var bgShadowView: UIView = {
|
|
|
|
let view = UIView()
|
|
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
return view
|
|
|
|
}()
|
|
|
|
|
|
|
|
var bgView: UIView = {
|
|
|
|
let view = UIView()
|
|
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
view.layer.masksToBounds = true
|
|
|
|
view.layer.cornerRadius = 30
|
|
|
|
return view
|
|
|
|
}()
|
|
|
|
|
|
|
|
var titleLabel: UILabel = {
|
|
|
|
let label = UILabel()
|
|
|
|
label.textAlignment = .center
|
|
|
|
label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
return label
|
|
|
|
}()
|
|
|
|
|
|
|
|
init() {
|
|
|
|
super.init(frame: .zero)
|
|
|
|
configure()
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
super.init(coder: coder)
|
|
|
|
configure()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension PickServerCategoryView {
|
2021-03-06 07:46:04 +01:00
|
|
|
|
2021-02-23 15:14:10 +01:00
|
|
|
private func configure() {
|
|
|
|
addSubview(bgView)
|
|
|
|
addSubview(titleLabel)
|
2021-03-05 15:50:20 +01:00
|
|
|
|
2021-04-06 10:42:45 +02:00
|
|
|
bgView.backgroundColor = Asset.Colors.Background.systemBackground.color
|
2021-03-05 15:50:20 +01:00
|
|
|
|
2021-02-23 15:14:10 +01:00
|
|
|
NSLayoutConstraint.activate([
|
|
|
|
bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
|
|
|
bgView.trailingAnchor.constraint(equalTo: self.trailingAnchor),
|
|
|
|
bgView.topAnchor.constraint(equalTo: self.topAnchor),
|
|
|
|
bgView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
|
2021-03-05 15:50:20 +01:00
|
|
|
|
2021-02-23 15:14:10 +01:00
|
|
|
titleLabel.centerXAnchor.constraint(equalTo: self.centerXAnchor),
|
|
|
|
titleLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor),
|
|
|
|
])
|
|
|
|
}
|
2021-03-06 07:46:04 +01:00
|
|
|
|
2021-03-05 15:50:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG && canImport(SwiftUI)
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct PickServerCategoryView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
UIViewPreview {
|
|
|
|
PickServerCategoryView()
|
2021-02-23 15:14:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-05 15:50:20 +01:00
|
|
|
#endif
|