Skip to content

Commit

Permalink
Merge pull request #128 from RomanPodymov/master
Browse files Browse the repository at this point in the history
More constants
  • Loading branch information
viniciussoares authored Nov 29, 2023
2 parents 96a3c9a + 60bcc9e commit 184b3fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/DatePickerDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ open class DatePickerDialog: UIView {
private let kDefaultButtonSpacerHeight: CGFloat = 1
private let kCornerRadius: CGFloat = 7
private let kDoneButtonTag: Int = 1
private let kDialogWidth = 300.0
private let kDialogHeight = 230.0

// MARK: - Views
private var dialogView: UIView!
Expand Down Expand Up @@ -81,7 +83,7 @@ open class DatePickerDialog: UIView {
/// Handle device orientation changes
@objc func deviceOrientationDidChange(_ notification: Notification) {
self.frame = UIScreen.main.bounds
let dialogSize = CGSize(width: 300, height: 230 + kDefaultButtonHeight + kDefaultButtonSpacerHeight)
let dialogSize = CGSize(width: kDialogWidth, height: kDialogHeight + kDefaultButtonHeight + kDefaultButtonSpacerHeight)
dialogView.frame = CGRect(
x: (UIScreen.main.bounds.size.width - dialogSize.width) / 2,
y: (UIScreen.main.bounds.size.height - dialogSize.height) / 2,
Expand Down Expand Up @@ -180,7 +182,7 @@ open class DatePickerDialog: UIView {
/// Creates the container view here: create the dialog, then add the custom content and buttons
private func createContainerView() -> UIView {
let screenSize = UIScreen.main.bounds.size
let dialogSize = CGSize(width: 300, height: 230 + kDefaultButtonHeight + kDefaultButtonSpacerHeight)
let dialogSize = CGSize(width: kDialogWidth, height: kDialogHeight + kDefaultButtonHeight + kDefaultButtonSpacerHeight)

// For the black background
self.frame = CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height)
Expand Down Expand Up @@ -247,7 +249,7 @@ open class DatePickerDialog: UIView {
let datePicker = UIDatePicker(frame: CGRect(x: 0, y: 30, width: 0, height: 0))
datePicker.setValue(self.textColor, forKeyPath: "textColor")
datePicker.autoresizingMask = .flexibleRightMargin
datePicker.frame.size.width = 300
datePicker.frame.size.width = kDialogWidth
datePicker.frame.size.height = 216
return datePicker
}
Expand Down

0 comments on commit 184b3fc

Please sign in to comment.