Closed m-etka closed 8 years ago
I have the same problem with XCode 7.3.1. It makes it unusable ....
Hey @mickaelmonsieur and @m-etka . I'm the new admin of this repo. Can you give me an example project of this problem? Everything works here
@riazurcse said: Hello Dear, I am using storyboard. If i set entry point using storyboard then dialog working fine. When i set rootViewController programmatically in AppDelegate, DatePickerDialog not working anymore.
window = UIWindow(frame: UIScreen.mainScreen().bounds) window?.makeKeyAndVisible()
storyboard = UIStoryboard(name: "Main", bundle: nil)
let homeViewController = self.storyboard?.instantiateViewControllerWithIdentifier("HomeView") as? HomeViewController
let userTypeController = self.storyboard?.instantiateViewControllerWithIdentifier("UserTypeView") as? UserTypeController
if self.window != nil {
let userDataExist = CommonUserFunction.isUserDataExist() as Bool
if userDataExist == true {
let navigationController:UINavigationController = storyboard!.instantiateInitialViewController() as! UINavigationController
navigationController.viewControllers = [homeViewController!]
self.window!.rootViewController = navigationController
}
else{
let navigationController:UINavigationController = storyboard!.instantiateInitialViewController() as! UINavigationController
navigationController.viewControllers = [userTypeController!]
self.window!.rootViewController = navigationController
}
}
please Help...Thanks in advance...
Hi @lfarah My problem is that I want to put the 'touch up inside' on the UITextField and not on a UIButton. And in this case it does not work...
@mickaelmonsieur I got it to work using the UITextFieldDelegate:
func textFieldDidBeginEditing(textField: UITextField)
The problem is that once you show it once, it won't show for the next time. Related to #27 I believe
Alright, now it works completely:
func textFieldDidBeginEditing(textField: UITextField) {
let dialog = DatePickerDialog()
// textField.resignFirstResponder()
dialog.show("DatePickerDialog", doneButtonTitle: "Done", cancelButtonTitle: "Cancel", datePickerMode: .Time) {
(date) -> Void in
if date != nil {
let calendar = NSCalendar.currentCalendar()
let comp = calendar.components([.Hour, .Minute], fromDate: date!)
let hour = comp.hour
let minute = comp.minute
self.textField.text = "\(hour):\(minute)"
} else {
self.textField.text = ""
}
}
}
We have a problem on the close() method that doesn't completely restarts the DatePicker
Hey guys, I launched a new version (9830aa0) 1.1.2
and these problems are fixed.
Please let me know if it worked for you guys 😉
xcode 7.3.1 : "if date != nil {" ---> Value of type 'NSDate' can never be nil, comparison isn't allowed
and the dialog will not open in my project, and in your demo either. (Only the button!)
Hey @mickaelmonsieur, is there any other way we can contact (via Twitter DM or Facebook Messages) so we can solve this? I just downloaded the example project and everything works here.
I have the same problem. How to solve?
In ios10, the first installation of the application, not pop-up dialog.
But I quit application, then the second time, to open is no problem.
When i set rootViewController programmatically in AppDelegate, DatePickerDialog not working anymore.
It works fine for me. Would you like to share the code that you're trying to run?
` window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.backgroundColor = UIColor.whiteColor()
window?.rootViewController = MainViewController()
window?.makeKeyAndVisible()`
When I click on the button, it will run the function. (selectDate()) And I added the two parameters in your code. max and min.
` func selectDate(){ DatePickerDialog().show("选择日期,最早日期为16-9-1", max: checkMax(), min:minDate,doneButtonTitle: "确定", cancelButtonTitle: "取消", datePickerMode: .Date) { (date) -> Void in
self.selDate = date
print("selectDate ->\(self.selDate)")
self.checkMax()
self.setTitleText()
self.ottLoad()
}
}`
.
` func show(title: String, max: NSDate,min: NSDate,doneButtonTitle: String, cancelButtonTitle: String, defaultDate: NSDate = NSDate(), datePickerMode: UIDatePickerMode = .DateAndTime, callback: ((date: NSDate) -> Void)) {
self.title = title
self.doneButtonTitle = doneButtonTitle
self.cancelButtonTitle = cancelButtonTitle
self.datePickerMode = datePickerMode
self.callback = callback
self.defaultDate = defaultDate
self.dialogView = createContainerView()
self.datePicker.maximumDate = max
self.datePicker.minimumDate = min
self.dialogView!.layer.shouldRasterize = true
self.dialogView!.layer.rasterizationScale = UIScreen.mainScreen().scale
self.layer.shouldRasterize = true
self.layer.rasterizationScale = UIScreen.mainScreen().scale
self.dialogView!.layer.opacity = 0.5
self.dialogView!.layer.transform = CATransform3DMakeScale(1.3, 1.3, 1)
self.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0)
self.addSubview(self.dialogView!)
/* Attached to the top most window (make sure we are using the right orientation) */
let interfaceOrientation = UIApplication.sharedApplication().statusBarOrientation
switch(interfaceOrientation) {
case UIInterfaceOrientation.LandscapeLeft:
let t: Double = M_PI * 270 / 180
self.transform = CGAffineTransformMakeRotation(CGFloat(t))
break
case UIInterfaceOrientation.LandscapeRight:
let t: Double = M_PI * 90 / 180
self.transform = CGAffineTransformMakeRotation(CGFloat(t))
break
case UIInterfaceOrientation.PortraitUpsideDown:
let t: Double = M_PI * 180 / 180
self.transform = CGAffineTransformMakeRotation(CGFloat(t))
break
default:
break
}
self.frame = CGRectMake(0, 0, self.frame.width, self.frame.size.height)
UIApplication.sharedApplication().windows.first!.addSubview(self)
/* Anim */
UIView.animateWithDuration(
0.2,
delay: 0,
options: UIViewAnimationOptions.CurveEaseInOut,
animations: { () -> Void in
self.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4)
self.dialogView!.layer.opacity = 1
self.dialogView!.layer.transform = CATransform3DMakeScale(1, 1, 1)
},
completion: nil
)
}`
IOS10 have this problem.But IOS9 there is no problem.
Hmm works for me on iOS10.
When i set rootViewController programmatically in AppDelegate, DatePickerDialog not working anymore. But I quit application, then the second time, to open is no problem. @benjohnde If you try, I believe you'll also have the same problem. I use Xcode 7.3 ,swift 2.3 , and ios 10 @lfarah Please Help~
Hi,guys, I'm not kidding. why do not you answer me? @benjohnde @lfarah
I will look into this issue in more depth on Monday.
Do you have any example project regarding your use case? You could create a repo, this would make things easier for us to deep dive into your issue.
@nschucky can you give a help?
Sorry, I'm a rookie. I won't create a repo. But I believe that if you do this, you will also appear this bug. When i set rootViewController programmatically in AppDelegate, DatePickerDialog not working anymore. In ios 10. @benjohnde Sorry.
@shenyufei I think it is not really an effort for you to provide us with a sample project. You ask for help -- we want to help! We are not kidding either. I can not reproduce your bug on iOS 10, even when playing around with the UIWindow and rootViewController.
If you won't create a repo, nobody can help you. Here you can see what I tried to reproduce your bug: https://github.com/benjohnde/DialogAppearance.
Works fine for me. I guess you have two options: think about your code and debug it yourself or provide us with code, that does not work.
Cheers!
Hi, I know how to create a repo, and really have problems, please look at https://github.com/shenyufei/DialogAppearExample @benjohnde
It's working for me! Using iOS 10.1 (Simulator and Device) and Xcode 8.1 (8B62). I converted your code to the most recent Swift 2.3 Syntax.
Sorry, I tried last week is a bug, but no bug on the upload, so I find the problem, I will contact you
Dialog doesn't appear on my project.
Dialog view's frame seems to be correct:
(0.0, 0.0, 320.0, 568.0)
Also I tried to bring subview front by adding this line in the
func show:
method:UIApplication.sharedApplication().windows.first!.bringSubviewToFront(self)
I'm using a navigation view controller under a tab bar controller. When debugging nothing seems to be wrong. I think it's only a visibility problem.
Any idea?