xib文件是
import Foundation
import UIKit
class DateSelectionView : UIView {
@IBOutlet weak var month: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setUpViewSyle()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder : aDecoder)
setUpViewSyle()
}
override func awakeFromNib() {
}
func setUpViewSyle() {
self.backgroundColor = AppConfig.UI.themeColor
}
}
我需要在任何collectionView中使用这个xib文件,并更新循环中的月份和剩余标签,如下所示,
let cell = dateCollectionView.dequeueReusableCell(withReuseIdentifier:
"DateSelectionCell", for: indexPath) as! DateSelectionViewCell
cell.month.text = "Jan"