Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
13
iphone/Maps/Classes/Components/LeftAlignedIconButton.swift
Normal file
13
iphone/Maps/Classes/Components/LeftAlignedIconButton.swift
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
@IBDesignable
|
||||
class LeftAlignedIconButton: UIButton {
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
contentHorizontalAlignment = .left
|
||||
let availableSpace = bounds.inset(by: contentEdgeInsets)
|
||||
let imageWidth = imageView?.frame.width ?? 0
|
||||
let titleWidth = titleLabel?.frame.width ?? 0
|
||||
let availableWidth = availableSpace.width - imageEdgeInsets.right - imageWidth * 2 - titleWidth
|
||||
titleEdgeInsets = UIEdgeInsets(top: 0, left: floor(availableWidth) / 2, bottom: 0, right: 0)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue