IGListKit/Examples/Examples-iOS/IGListKitExamples/Views/CenterLabelCell.swift

37 lines
814 B
Swift
Raw Normal View History

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import UIKit
final class CenterLabelCell: UICollectionViewCell {
lazy private var label: UILabel = {
let view = UILabel()
view.backgroundColor = .clear
view.textAlignment = .center
view.textColor = .white
view.font = .boldSystemFont(ofSize: 18)
self.contentView.addSubview(view)
return view
}()
var text: String? {
get {
return label.text
}
set {
label.text = newValue
}
}
override func layoutSubviews() {
super.layoutSubviews()
label.frame = contentView.bounds
}
}