Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding direction changes option #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -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 {

Expand Down
12 changes: 11 additions & 1 deletion DropDown/src/DropDown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public final class DropDown: UIView {
willSet { tableView.separatorColor = newValue }
didSet { reloadAllComponents() }
}

/**
The corner radius of DropDown.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down