Files
UnrealEngine/Engine/Extras/VirtualProduction/LiveLinkVCAM/vcam/ConnectButton.swift
2025-05-18 13:04:45 +08:00

40 lines
1011 B
Swift

//
// ConnectButton.swift
// vcam
//
// Created by Brian Smith on 12/4/20.
// Copyright Epic Games, Inc. All Rights Reserved.
//
import UIKit
class ConnectButton : UIButton {
override var isEnabled: Bool {
didSet {
let c = isEnabled ? self.titleColor(for: .normal) : self.titleColor(for: .disabled)
self.layer.borderColor = c?.cgColor
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.setTitleColor(UIColor.lightGray, for: .disabled)
self.layer.cornerRadius = 5
self.layer.borderWidth = 1
self.layer.borderColor = UIColor.white.cgColor
self.semanticContentAttribute = .forceRightToLeft
self.titleLabel?.textAlignment = .left
}
override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
var titleRect = super.titleRect(forContentRect: contentRect)
titleRect.origin.x = contentRect.origin.x + 6
return titleRect
}
}