diff --git a/DropDown/helpers/DPDConstants.swift b/DropDown/helpers/DPDConstants.swift index b5caa30..b3475c6 100644 --- a/DropDown/helpers/DPDConstants.swift +++ b/DropDown/helpers/DPDConstants.swift @@ -33,6 +33,7 @@ internal struct DPDConstant { static let CornerRadius: CGFloat = 2 static let RowHeight: CGFloat = 44 static let HeightPadding: CGFloat = 20 + static let Direction:NSTextAlignment = .left struct Shadow { diff --git a/DropDown/src/DropDown.swift b/DropDown/src/DropDown.swift index 25fa2b2..c075395 100644 --- a/DropDown/src/DropDown.swift +++ b/DropDown/src/DropDown.swift @@ -216,7 +216,7 @@ public final class DropDown: UIView { willSet { tableView.separatorColor = newValue } didSet { reloadAllComponents() } } - + /** The corner radius of DropDown. @@ -331,6 +331,15 @@ public final class DropDown: UIView { @objc public dynamic var textColor = DPDConstant.UI.TextColor { didSet { reloadAllComponents() } } + + /** + The direction of the text for each cells of the drop down. + + Changing the direction automatically reloads the drop down. + */ + @objc public dynamic var directionCellLabel:NSTextAlignment = DPDConstant.UI.Direction { + didSet { reloadAllComponents() } + } /** The color of the text for selected cells of the drop down. @@ -1064,6 +1073,7 @@ extension DropDown: UITableViewDataSource, UITableViewDelegate { cell.optionLabel.textColor = textColor cell.optionLabel.font = textFont + cell.optionLabel.textAlignment = directionCellLabel cell.selectedBackgroundColor = selectionBackgroundColor cell.highlightTextColor = selectedTextColor cell.normalTextColor = textColor