iOS Tutorial: Date Picker in a UITextField

preview_player
Показать описание
Check out my new full length iOS course:

--
50% off my iOS Development Fundamentals Course on Udemy:

or use CODEPRO999 for 50% off the course price.

--
In this tutorial we will learn how to add a Date Picker also known as a UIDatePicker to a UITextField as the input view. We will learn how to invoke the Date Picker and make a date selection as well learn how to format the date. We will also learn how we can use a UITapGestureRecognizer to detect when a tap is selected to automatically dismiss the Date Picker. This tutorial is in Swift 4 using Xcode 9.

--

My iOS Development Fundamentals Course

--

Useful Learning Resources

--

Check out some of the apps I've built:

--

Follow Code Pro on:

If you found this tutorial helpful please like the video, share the video, and subscribe to CodePro. You can follow CodePro on Twitter, Facebook, for the latest channel news and updates.
Рекомендации по теме
Комментарии
Автор

Clean, short, easy. This was amazing, thank you!

TinaDitteThomsen
Автор

Love the way you dig into the UIKit Base classes and show what's available 👍

abrahamlincoln
Автор

Very clearly explained. I like how you went into the underlying classes to teach the bigger picture. Thanks.

zippytoad
Автор

This was one of the best tutorials of its kind I've seen - really educational and thorough while simultaneously to the point and quick. Thank you - very well done! I'll be back for more!

flotsamjetsam
Автор

I find your tutorials very helpful! I really like that you don't make them too basic and also that you actually explain things. Thank you.

iryna
Автор

Great tutorial, thanks a lot for sharing! It helped me a lot.
I had an issue though when picking a day or month or year; it would dismiss the DatePicker straight away.
Couldn't choose the full date all at once. Not great in terms of user experience 😉
💡To fix that I removed the "view.endEditing(true)" from the dateChanged function.
(I'm using Xcode 11.3)

stillboblemarin
Автор

please tell me how to open datepicker on text field input view in SwiftUI ios 13?

AkankshaSingh-ikcp
Автор

im having trouble converting this to a date and time picker? what parts would i alter?

saalikahmed
Автор

the inputTextfield.inputView = datePicker line of code doesn't work, how can I fix it?
-The error message that shows up is Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value.

TF-fvih
Автор

Hi, a very helpful video, question: What if i want to have two date pickers in the same view?

oswaldogallo
Автор

Thanks a lot for this tutorial! I'm doing similar app for a job interview and it helped me a lot! Can you please prompt me how to get that textField value, selected by pickerView to pass to another VC? Can't understand what should I do :(

ZHANEKA
Автор

thanks a lot I figured out what I needed to do

akaaadikhan
Автор

i would suggest to remove the code on line 32 where this line auto dismiss the datepicker whenever the date changed (i've change the year, but when i wanted to change the month, it dismiss ) .

limsteven
Автор

Hey Code Pro you're a great teacher. I signed up for a Udemy iOS class but am unhappy with that instructor. I'm going to sign up for yours instead. The only instructor I've seen who is even better is the guy from Stanford who put his iOS lectures on YouTube. You're in the same league though :-)

csmaca
Автор

Thanks a Lot.. Tutorial is really helpful..you have done a great work.. Cheers!!

ashiquepuliyakkode
Автор

how did change the UIDatepicker's date format? Because it only shows mm/dd/yyyy format only but i want to change the dd/mm/yyyy format of date in UIDatepicker. Please help to change.

mvijay
Автор

I have tapped the same code as he did, but I have an error saying my view controller is not initialized? What should I do? Thank you very much in advance!!

ramymeng
Автор

Your tutorials have helped me fix code that was poor, in my app, THANK YOU

kidsrollcallaustralia
Автор

Hello. Thank you for you tutorial!
But if I use "TouchUpOutside" instead of "value changed", then the app does not change the date. Have I to implement anything else at "TouchUpOutside" function? Please help...thanks

elturko
Автор

GREAT TUTORIAL !
QUESTION : how could you use UIDatePicker to set up a personal calendar, like a diary where you put notes for different dates ?

kidsrollcallaustralia
join shbcf.ru