-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSliderMenuCell.swift
70 lines (56 loc) · 2.36 KB
/
SliderMenuCell.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// SliderMenuCell.swift
// BottomSlideMenu
//
// Created by AmitThakur on 25/07/19.
// Copyright © 2019 Mayurpankh. All rights reserved.
//
import UIKit
class SliderMenuCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
setupviews()
}
let cellImageView: UIImageView = {
let iv = UIImageView()
iv.image = UIImage(named: "DuaLipa")
iv.contentMode = .scaleAspectFill
iv.layer.cornerRadius = 14
iv.layer.masksToBounds = true
iv.translatesAutoresizingMaskIntoConstraints = false
return iv
}()
let cellLabel: UILabel = {
let cl = UILabel()
cl.text = "duaLipa"
cl.translatesAutoresizingMaskIntoConstraints = false
return cl
}()
let cellBottomLineView: UIView = {
let lv = UIView()
lv.backgroundColor = UIColor.darkGray
lv.translatesAutoresizingMaskIntoConstraints = false
return lv
}()
func setupviews() {
//setup views
addSubview(cellImageView)
addSubview(cellBottomLineView)
addSubview(cellLabel)
cellImageView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 8).isActive = true
cellImageView.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
cellImageView.widthAnchor.constraint(equalToConstant: 28).isActive = true
cellImageView.heightAnchor.constraint(equalToConstant: 28).isActive = true
cellBottomLineView.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
cellBottomLineView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
cellBottomLineView.widthAnchor.constraint(equalTo: self.widthAnchor).isActive = true
cellBottomLineView.heightAnchor.constraint(equalToConstant: 2).isActive = true
cellLabel.leftAnchor.constraint(equalTo: cellImageView.rightAnchor, constant: 8).isActive = true
cellLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
cellLabel.widthAnchor.constraint(equalTo: self.widthAnchor).isActive = true
cellLabel.heightAnchor.constraint(equalToConstant: 20).isActive = true
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}