-
Notifications
You must be signed in to change notification settings - Fork 651
Expand file tree
/
Copy pathMySecondCell.swift
More file actions
39 lines (34 loc) · 1.26 KB
/
MySecondCell.swift
File metadata and controls
39 lines (34 loc) · 1.26 KB
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
//
// MySecondCell.swift
// Demo
//
// Created by Aleksei Cherepanov on 31/10/2018.
// Copyright © 2018 Kevin Hirsch. All rights reserved.
//
import UIKit
import DropDown
class MySecondCell: DropDownCustomCell {
var logoImageView = UIImageView(frame: .zero)
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.addSubview(logoImageView)
}
override func layoutSubviews() {
super.layoutSubviews()
let size = contentView.bounds.size
let imageSize = logoImageView.image?.size ?? .zero
let padding: CGFloat = 4
logoImageView.frame = CGRect(x: padding,
y: (frame.height - imageSize.height)/2,
width: imageSize.width,
height: imageSize.height)
let offset = padding * 2 + imageSize.width
optionLabel.frame = CGRect(x: offset,
y: 0,
width: size.width - offset,
height: size.height)
}
}