Merge branch 'feature/text_alignment' into 'develop'

text alignment and mark fix

See merge request BPHV_MIPS/mvm_core_ui!111
This commit is contained in:
Pan, Xinlei (Ryan) 2019-08-12 15:33:31 -04:00
commit a6be4887ec
2 changed files with 13 additions and 2 deletions

View File

@ -178,6 +178,17 @@ public typealias ActionBlock = () -> Void
setLabel(label, withHTML: json?.optionalStringForKey("html")) setLabel(label, withHTML: json?.optionalStringForKey("html"))
if let alignment = json?.optionalStringForKey("textAlignment") {
switch alignment {
case "center":
label.textAlignment = .center
case "trailing":
label.textAlignment = .right
default:
label.textAlignment = .left
}
}
if let backgroundColorHex = json?.optionalStringForKey(KeyBackgroundColor), !backgroundColorHex.isEmpty { if let backgroundColorHex = json?.optionalStringForKey(KeyBackgroundColor), !backgroundColorHex.isEmpty {
label.backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) label.backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
} }
@ -368,6 +379,7 @@ extension Label {
public func reset() { public func reset() {
text = nil text = nil
attributedText = nil attributedText = nil
textAlignment = .left
originalAttributedString = nil originalAttributedString = nil
styleB2(true) styleB2(true)
} }

View File

@ -21,7 +21,7 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
private var topViewBottomConstraint: NSLayoutConstraint? private var topViewBottomConstraint: NSLayoutConstraint?
private var bottomViewTopConstraint: NSLayoutConstraint? private var bottomViewTopConstraint: NSLayoutConstraint?
//MARK: - MVMCoreViewProtocol //MARK: - MFViewController
open override func updateViews() { open override func updateViews() {
super.updateViews() super.updateViews()
let width = view.bounds.width let width = view.bounds.width
@ -37,7 +37,6 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
self.tableView?.reloadData() self.tableView?.reloadData()
} }
//MARK: - MFViewController
open override func newDataBuildScreen() { open override func newDataBuildScreen() {
super.newDataBuildScreen() super.newDataBuildScreen()
createViewForTableHeader() createViewForTableHeader()