-
Notifications
You must be signed in to change notification settings - Fork 0
/
WSCollectionViewCell.swift
50 lines (43 loc) · 1.24 KB
/
WSCollectionViewCell.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// WSCollectionViewCell.swift
// WolfStreet_iOS
//
// Created by zwj on 16/12/23.
// Copyright © 2016年 Wolf Street. All rights reserved.
//
import UIKit
import SnapKit
class WSCollectionViewCell: UICollectionViewCell {
lazy var title = UILabel()
lazy var image = UIImageView()
override init(frame:CGRect){
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
setupUI()
}
}
//界面布局
extension WSCollectionViewCell {
fileprivate func setupUI() {
//title.text = "微信"
title.font = UIFont.systemFont(ofSize: 11)
title.textColor = UIColor.white
contentView.addSubview(title)
contentView.addSubview(image)
//
image.snp.updateConstraints { (make) in
make.top.equalTo(self.contentView).offset(0)
make.centerX.equalTo(self.contentView).offset(0)
make.height.equalTo(50)
make.width.equalTo(50)
}
title.snp.updateConstraints { (make) in
make.top.equalTo(self.image.snp.bottom).offset(10)
make.centerX.equalTo(self.contentView).offset(0)
}
}
}