Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DropDown/helpers/DPDConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal struct DPDConstant {
static let CornerRadius: CGFloat = 2
static let RowHeight: CGFloat = 44
static let HeightPadding: CGFloat = 20
static let TextAlignment: NSTextAlignment = .left

struct Shadow {

Expand Down
1 change: 1 addition & 0 deletions DropDown/src/DropDown+Appearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extension DropDown {
appearance.textColor = DPDConstant.UI.TextColor
appearance.selectedTextColor = DPDConstant.UI.SelectedTextColor
appearance.textFont = DPDConstant.UI.TextFont
appearance.textAlignment = DPDConstant.UI.TextAlignment
}

}
Expand Down
10 changes: 10 additions & 0 deletions DropDown/src/DropDown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ public final class DropDown: UIView {
public var downScaleTransform = DPDConstant.Animation.DownScaleTransform {
willSet { tableViewContainer.transform = newValue }
}

/**
The text alignment of the optionLabel for each cells of the drop down.

Changing the alignment color automatically reloads the drop down.
*/
@objc public dynamic var textAlignment = DPDConstant.UI.TextAlignment {
didSet { reloadAllComponents() }
}

/**
The color of the text for each cells of the drop down.
Expand Down Expand Up @@ -1078,6 +1087,7 @@ extension DropDown: UITableViewDataSource, UITableViewDelegate {
cell.selectedBackgroundColor = selectionBackgroundColor
cell.highlightTextColor = selectedTextColor
cell.normalTextColor = textColor
cell.optionLabel.textAlignment = textAlignment

if let cellConfiguration = cellConfiguration {
cell.optionLabel.text = cellConfiguration(index, dataSource[index])
Expand Down