uidatepicker

UIDatePicker in UIDatePickerModeCountDownTimer mode: how to change to minutes and seconds mode?

本秂侑毒 提交于 2019-12-10 09:22:56
问题 I added UIDatePicker in my storyboard, and set mode to CountDownTimer. It shows hours and minutes only, but what i need is minutes and seconds mode. I don't need hour column, need minute and seconds columns. I try to change interval, but it's minimum value is 1 minute. Is it possible? How can I do this? 回答1: You can create a datasource for you minute-seconds picker. It has two Components: minute and seconds. You have to implement some methods in UIPickerViewDelegate and UIPickerViewDataSource

How to change UIDatePicker to a specific time (in code)

吃可爱长大的小学妹 提交于 2019-12-10 01:14:38
问题 I need to change the UIDatePicker to a specific dynamically. My date picker is set to time mode only. i can set the time with timePicker.setDate(NSDate(), animated: false) but i cant figure out how to change it to a different time and not to current time. So how do i change it? Thanks 回答1: You've to change the time , you can do it using NSDateComponents and set the modified date to your DatePicker var calendar:NSCalendar = NSCalendar.currentCalendar() let components = calendar.components

how to implement date picker on button click in ios?

巧了我就是萌 提交于 2019-12-09 14:52:03
问题 I am building an iOS app.I am using storyboards to build the screens and i have made a form which contain some fields like Name,Date,min and max. I am facing an problem that is not able to implement date picker on button click and when user select the date,date picker hide,want to display selected date in a label. I googled but could not find a good tutorial or library. I want to show only days and date in picker. 回答1: -(IBAction)datePickerBtnAction:(id)sender { datePicker =[[UIDatePicker

Detect iPhone 24-Hour time setting

我是研究僧i 提交于 2019-12-09 12:02:15
问题 I'm using a UIDatePicker to select a time. I am also customising the background of the picker, however I need 2 different images depending on whether the user is using 12 hour mode (which displays AM/PM column) or 24 hour mode. How can I detect the users setting for the 12/24 hour time? Thanks 回答1: one two three and there's probably many, many more... 回答2: Even shorter than the others: NSString *format = [NSDateFormatter dateFormatFromTemplate:@"j" options:0 locale:[NSLocale currentLocale]];

Loading a UIDatePicker in Landscape on a UINavigationController

ⅰ亾dé卋堺 提交于 2019-12-09 09:46:28
问题 I have a custom UINavigationController that supports auto-rotate. I also have a UIDatePicker on one of my views that I throw onto the stack of the Navigation controller. The auto-rotate works if I start the date picker view in portrait and then rotate it. If I try load the date picker view in landscape to begin with, the view is all messed up. It looks like it would if it didn't support rotation and the frame only has about half of the picker visible and off center. I've tried making my own

Disable Past Date in UIDatePicker in IPhone Objective C

左心房为你撑大大i 提交于 2019-12-09 07:25:32
问题 I am new to Objective C and IPhone development. I am using a UIDatePicker in my IPhone Application and my requirement is to allow the user to choose the future date only from the DatePicker. To do this i want to disable past date & time in DatePicker only instead of putting a compare validation in the code. Is this possible or there is an option to disable the past date in the DatePicker control itself. 回答1: Did you try this [picker setMinimumDate: [NSDate date]]; 回答2: Use the following line

How to add Date picker in Action Sheet?

拜拜、爱过 提交于 2019-12-08 17:09:29
问题 - (IBAction) showCatPicker { if (self.catList !=nil) { self.catList=nil; [catList release]; } self.catList = [[NSMutableArray alloc] init]; self.actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [self.actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; CGRect pickerFrame = CGRectMake(0, 40, 0, 0); if(self.catPicker == nil) { self.catPicker = [[UIPickerView alloc] initWithFrame

Detect if UIDatePicker is rolling?

江枫思渺然 提交于 2019-12-08 16:24:06
问题 I'm using a UIDatePicker in a modal view, to select a date. I found that if the view is closed while the date picker is still rolling, I got a EXC_BAD_ACCESS. How can I detect of the date picker is rolling when the user tab a button? I had two ideas: 1) detect if the value has changed with this: [myDatePicker addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; But I would need to be able to detect if the value WILL change. 2) check if the date is valid

Swift: How to get string values of days, months and year from a date picker?

[亡魂溺海] 提交于 2019-12-08 13:54:35
问题 i want to get the separate Strings values of day,Month,year from a date picker. and assign these three values to a 3 variables. I have done upto this: @IBAction func doneClicked(sender: UIButton) { let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = GlobalConfiguration.getDatePickerFormat() let formattedDate = dateFormatter.stringFromDate(self.datePicker.date) self.delegate?.datePickerDidSelect(formattedDate) } this is my few codes and i can set the date text as a string to the

jQuery UI Datepicker and Timezones

允我心安 提交于 2019-12-08 13:52:39
I use the datepicker to gererate a requested delivery date on my site. Same day delivery is available until 3pm GMT, so I run a script to move the calendars current selection on by 1 day at that time. The 3pm is generated on the server and not the client machine to ensure the correct time. I would like to overcome this problem: Australian customers moves forward by 1 day as the date there changes naturally (they are 11 hours ahead), this means they miss out on approx 3 hours of same day delivery - but I can live with that. However, when my script kicks in at 3pm UK time they get nudged on