one line, truncation.

This commit is contained in:
Kevin G Christiano 2020-01-13 14:31:04 -05:00
parent 0b87ff254b
commit 8ff92b5cc0

View File

@ -8,6 +8,7 @@
import UIKit
@objcMembers open class Link: MFCustomButton {
//--------------------------------------------------
// MARK: - Properties
@ -62,8 +63,7 @@ import UIKit
context?.move(to: CGPoint(x: x, y: y))
context?.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
context?.closePath()
context?.drawPath(using: .stroke)
context?.strokePath()
}
//--------------------------------------------------
@ -77,7 +77,7 @@ import UIKit
// MARK: - AppleGuidelinesProtocol
extension Link: AppleGuidelinesProtocol {
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return Self.acceptablyOutsideBounds(point: point, bounds: bounds)
@ -108,9 +108,10 @@ extension Link: MVMCoreViewProtocol {
contentMode = .redraw
setTitleColor(.mfTextButton(), for: .normal)
setTitleColor(.mfCharcoal(), for: .highlighted)
titleLabel?.numberOfLines = 1
titleLabel?.lineBreakMode = .byTruncatingTail
titleLabel?.textAlignment = .left
contentHorizontalAlignment = .left
titleLabel?.numberOfLines = 1
}
}
@ -125,20 +126,19 @@ extension Link: MVMCoreUIMoleculeViewProtocol {
self.additionalData = additionalData
self.delegateObject = delegateObject
guard let unwrappedJson = json else { return }
actionMap = unwrappedJson
guard let dictionary = json else { return }
actionMap = dictionary
buttonDelegate = delegateObject?.buttonDelegate
let color = unwrappedJson.stringForkey(KeyTextColor)
let color = dictionary.stringForkey(KeyTextColor)
setTitleColor(.mfGet(forHex: color), for: .normal)
if let title = unwrappedJson.optionalStringForKey(KeyTitle) {
if let title = dictionary.optionalStringForKey(KeyTitle) {
setTitle(title, for: .normal)
}
if let enabled = unwrappedJson[KeyEnabled] as? Bool {
if let enabled = dictionary[KeyEnabled] as? Bool {
isEnabled = enabled
}
}