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

Missing Done Button #107

Open
azhararmar opened this issue Sep 13, 2018 · 6 comments
Open

Missing Done Button #107

azhararmar opened this issue Sep 13, 2018 · 6 comments

Comments

@azhararmar
Copy link

I am using the library with following code

 DatePickerPopover(title: "Date Of Birth")
            .setDateMode(.date)
            .setSelectedDate(startDate!)
            .setMaximumDate(today)
            .setDoneButton(title: "Done", color: .red, action: { popover, selectedDate in
                self.selectedDOB = selectedDate
                self.dobPickerLabel.text = selectedDate.toString(dateFormat: "MMMM dd, yyyy")
            })
            .setCancelButton(action: { (_, _) in
                print("Cancel Button")
            })
            .appear(originView: self.dobContainerView, baseViewController: self)

The problem is, done button and cancel button is not displayed in the popover, however the area is clickable. When I click on the area of done button, it does trigger done button delegate and hides the popover, same for cancel button. PFA screenshot for the same

screen shot 2018-09-13 at 12 28 42 pm

I am running with following config
Xcode: 9.0
iOS version: 9.0
Swift: 4.0

What is possibly wrong here?

@hsylife
Copy link
Owner

hsylife commented Sep 15, 2018

Weird . I will inspect it. Please give me some time,

@hsylife
Copy link
Owner

hsylife commented Sep 16, 2018

@azhararmar
Do you use UIAppearance? If so, please share the code.

@azhararmar
Copy link
Author

azhararmar commented Sep 16, 2018

In AppDelegate I am using the following

UINavigationBar.appearance().tintColor = UIColor.black
UINavigationBar.appearance().backgroundColor = UIColor.white
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.clear], for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.clear], for: .highlighted)

@azhararmar
Copy link
Author

azhararmar commented Sep 16, 2018

Okay, when I commented the code, Done button and Cancel is visible and working. I want to keep the appearance without conflicting SwiftyPickerPopover, is there a workaround you would suggest?

@hsylife
Copy link
Owner

hsylife commented Jan 6, 2019

I think we have to change code of the oss.

let color = popover.doneButton.color ?? popover.tintColor
var attributes = doneButton.titleTextAttributes(for: .normal) ?? [:]
attributes[NSAttributedString.Key.foregroundColor] = color
doneButton.setTitleTextAttributes(attributes, for: .normal)

@hsylife
Copy link
Owner

hsylife commented Jan 6, 2019

I'm developing for it on the branch of "feature/global_appearance_support", and planing to release it as v6.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants