uidatepicker

UIDatePicker constraints not working in device

本秂侑毒 提交于 2019-12-25 05:30:06
问题 I am using UIDatePicker control in my project. Added the UIDatePicker in xib file, and programmatically setting the constraints such as minimumDate, maximumDate to the datePicker. This is working fine in simulator, but in device I am able to select any date in datePicker. Sample code: - (void)viewDidLoad { [super viewDidLoad]; [self.datePicker setMinimumDate:[NSDate date]]; [self.datePicker setMaximumDate:[[NSDate date] dateByAddingTimeInterval:3*24*60*60]]; } screenshot: Note: I am working

Swift passing parameter on #selector

ぃ、小莉子 提交于 2019-12-24 20:52:13
问题 How can I use the same function to handle DatePickerView on 2 different textFields? To avoid repetition, I would like to set up 2 textFields with a DatePicker. One field is for issue date and the other one for due date. When I try to add parameter on @objc func doneClick, I got a compiler error ==> Instance member 'doneClick' cannot be used on type 'InvoiceViewController'; did you mean to use a value of this type instead? import UIKit class InvoiceViewController: UIViewController,

uidatepicker in uipopover delegate

无人久伴 提交于 2019-12-24 10:46:14
问题 I am trying to insert a uipopover with uidatepicker in it with two buttons - Cancel and Done. I was able to design the layout using storyboard with the help of UIDatePicker in UIPopover and How can I show a UIDatePicker inside a Popover on iPad using StoryBoard? But, I am not able to get the date from uidatepicker to uiviewcontroller when Done button is pressed. I am new to ios programming and i find delegate methods very confusing. Could somebody shed some light? Help much appreciated. Thank

Dates in UIDatepicker not displaying properly

断了今生、忘了曾经 提交于 2019-12-24 10:44:31
问题 I have UIDatepicker .I have few queries to ask 1.)When i tap on UIButton the dates in datepicker gets retuns to minimum value since i have given maximum and minimum value . In doing that function the date in datepicker appears to be in non highlighted manner ![enter image description here. The link mentioned below shows how the date appears in datepicker http://postimg.org/image/7mlxiq6sz/ - (IBAction)notificationButtonChanged:(UIButton *)control { NSUserDefaults *defaults = [NSUserDefaults

Changing locale of UIDatePicker in Countdown Timer mode

╄→гoц情女王★ 提交于 2019-12-24 09:21:04
问题 I have UIDatePicker in CountdownTimer mode and need to change the wording of hours and min to German locale. I tried both, to set locale to German (Germany) in storyboard and in code, but both failed and the app still shows default english words for hours and min . timePicker.locale = Locale(identifier: "de") When I configure locale on UIDatePicker in Date and Time mode, it correctly respects German locale and displays the date in german format. Any idea why locale does not change in

UIDatePicker hours interval (NSCalendarUnit?)

你离开我真会死。 提交于 2019-12-24 08:16:45
问题 I'm trying to make a UIDatePicker wich is alowing to select hours only betwen 6.00 and 17.00. The other hours shall be inactive but still visible. I think it can be done with setting up the picker calendar and then use this: - (NSRange)maximumRangeOfUnit:(NSCalendarUnit)unit but i'm nou sure how. Maybe someone can help me. Thank you! 回答1: Sorry, but UIDatePicker doesn't support setting valid time ranges like you describe. The only options are minimum and maximum dates. You'll either need to

Can the clicking sound of UIDatePicker be disabled?

半腔热情 提交于 2019-12-24 02:10:52
问题 I'm not sure if I am overlooking an obvious setting, but is there a way to disable the clicking of a UIDatePicker when the value of the date picker is changed (by the user of programmatically)? During my search, I have come across an undocumented method, but that is not what I am planning to adopt. 回答1: At the time of writing, it seems that the clicks generated by UIPickerView can only be disabled by the user in the global settings of the device. This also disables the keyboard clicks as a

UIDatePicker with 5 min interval get date on appear with interval

自闭症网瘾萝莉.ら 提交于 2019-12-24 00:39:49
问题 I have spent about 3 hours trying to get a UIDatePicker to do what I want it to do. I have it setup as an action of a UITextField to segue to a new view controller with a UIDatePicker . This is all working. I have been able to select a date and send it back to the original view controller. The problem is that I am using 5 minute time intervals. If I don't move the date picker "wheels" and select my done button to return to the parent controller the non-interval time is returned. So 11:37

Swift change date picker language

こ雲淡風輕ζ 提交于 2019-12-24 00:37:54
问题 I want to change format of month represent in my UIDatePicker. I tried: self.datePicker = UIDatePicker() self.datePicker.backgroundColor = .white self.datePicker.datePickerMode = .date let loc = Locale.init(identifier: "uk") var calendar = Calendar.current calendar.locale = loc self.datePicker.calendar = calendar After that, month representation suppose to be in ukranian, but it still in other language. 回答1: You should assign loc to the date picker locale property: let loc = Locale(identifier

UIDatePicker Flips on iOS9 RTL

…衆ロ難τιáo~ 提交于 2019-12-23 23:07:26
问题 I have a weird issue when displaying a DatePicker - Time mode on RTL. Im displaying the date picker programmatically. Minutes should be on the right side, and hours on the left, and on the following image you can see it's flipped: It happens on iOS 9 and above. The code I'm using: UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height+44, self.view.frame.size.width, 216)]; datePicker.tag = tag; [datePicker setSemanticContentAttribute