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