Date Picker View Super Small - Swift Xcode

Christian W

I've got a view controller with different textfields, two of which are for dates. I'm trying to make a date picker appear when the user taps in the text field, for ease of use. For some reason, the date picker looks like this:

enter image description here

I don't know why the image is so big on stack overflow lol

Here is my code:

    func createDatePicker() {
        // toolbar
        let toolbar = UIToolbar()
        toolbar.delegate = self
        toolbar.sizeToFit()
        
        // bar button
//        let doneBtn = UIBarButtonItem(barButtonSystemItem: .done, target: nil, action: nil)
        
        // assign toolbar to textviews
        lossDateTextField.inputAccessoryView = toolbar
        dateTakenTextField.inputAccessoryView = toolbar
        
        // assign date picker to textfields
        lossDateTextField.inputView = datePicker
        dateTakenTextField.inputView = datePicker
        
    }

I set the text field delegate to self in viewDidLoad and call the createDatePicker function there as well.

Why is it appearing like this instead of how it's supposed to?

Note: I am using IQKeyboardManagerSwift in the app.

Thanks

Nisarg Shah

Just add bellow code and your date picker will work fine.

       if #available(iOS 13.4, *) {
            datePicker!.preferredDatePickerStyle = .wheels
       }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Strange date picker behaviour Xcode, swift 3

From Dev

Manipulate the date picker view

From Dev

Date Picker Layout View

From Dev

Picker View Swift

From Dev

android calendar view date picker

From Dev

Get date from date picker in swift

From Dev

Date range picker in Ember.view

From Dev

Reload Component in UI Picker View Swift

From Dev

swift ios adding search bar to picker view

From Dev

Random name selector using a picker view with swift

From Dev

How to add date picker to UIAlertController(UIAlertView) in Swift?

From Dev

Date Picker in iOS using Swift Programming

From Dev

unrecognized selector sent to instance date picker - swift

From Dev

How to add date picker to UIAlertController(UIAlertView) in Swift?

From Dev

Calculating Age From Date Picker Swift 3

From Dev

Add attribute to a date picker using Swift 3

From Java

Xcode 6 with Swift super slow typing and autocompletion

From Dev

Change UIView's super view with animation in Swift

From Dev

xcode swift for [[[view class] description]

From Dev

Xcode swift view wrap content

From Dev

xcode swift for [[[view class] description]

From Dev

swift 3 set date picker current date and calculate difference

From Dev

How to select a picker view item in an iOS UI test in Xcode?

From Dev

How to make date picker appear on button click as date picker is in top bar of view controller

From Dev

How can I populate a picker view depending on the selection of another picker view in Swift?

From Dev

How can I populate a picker view depending on the selection of another picker view in Swift?

From Java

iOS 7 - How to display a date picker in place in a table view?

From Dev

jQuery bootstrap date range picker with months only view mode

From Dev

How to add Date Picker in Horizontal paging scroll view?

Related Related

  1. 1

    Strange date picker behaviour Xcode, swift 3

  2. 2

    Manipulate the date picker view

  3. 3

    Date Picker Layout View

  4. 4

    Picker View Swift

  5. 5

    android calendar view date picker

  6. 6

    Get date from date picker in swift

  7. 7

    Date range picker in Ember.view

  8. 8

    Reload Component in UI Picker View Swift

  9. 9

    swift ios adding search bar to picker view

  10. 10

    Random name selector using a picker view with swift

  11. 11

    How to add date picker to UIAlertController(UIAlertView) in Swift?

  12. 12

    Date Picker in iOS using Swift Programming

  13. 13

    unrecognized selector sent to instance date picker - swift

  14. 14

    How to add date picker to UIAlertController(UIAlertView) in Swift?

  15. 15

    Calculating Age From Date Picker Swift 3

  16. 16

    Add attribute to a date picker using Swift 3

  17. 17

    Xcode 6 with Swift super slow typing and autocompletion

  18. 18

    Change UIView's super view with animation in Swift

  19. 19

    xcode swift for [[[view class] description]

  20. 20

    Xcode swift view wrap content

  21. 21

    xcode swift for [[[view class] description]

  22. 22

    swift 3 set date picker current date and calculate difference

  23. 23

    How to select a picker view item in an iOS UI test in Xcode?

  24. 24

    How to make date picker appear on button click as date picker is in top bar of view controller

  25. 25

    How can I populate a picker view depending on the selection of another picker view in Swift?

  26. 26

    How can I populate a picker view depending on the selection of another picker view in Swift?

  27. 27

    iOS 7 - How to display a date picker in place in a table view?

  28. 28

    jQuery bootstrap date range picker with months only view mode

  29. 29

    How to add Date Picker in Horizontal paging scroll view?

HotTag

Archive