• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Follow up to DatePicker Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Follow up to DatePicker Question


  • Subject: Follow up to DatePicker Question
  • From: David Grant <email@hidden>
  • Date: Wed, 20 May 2015 12:07:57 -0700

So I found that what I really really wanted was not a popover controller but an inputView.

When I test this in an iPhone 6 it seems to work just fine, but on testing an iPhone 5 the reaction to the date change is kind of slow.

Also, this seems like a lot of code to make this work, so I’m submitting it here because a) it does work, and b) I’m hoping to get some feedback and maybe clean it up or make it run even faster so their is no delay on the iPhone 5.

@IBOutlet weak var dateInput: UITextField!
@IBOutlet var inputDatePicker: UIDatePicker!


    func getDate()
    {
        let transactionDate = NSDate()
        let formatter = NSDateFormatter()
        formatter.dateStyle = .LongStyle

        var datePicker = UIDatePicker()
        datePicker.datePickerMode = UIDatePickerMode.Date
        dateInput.inputView = datePicker

        datePicker.addTarget(self, action: "updateDate:", forControlEvents: UIControlEvents.ValueChanged)

        self.dateInput.text = formatter.stringFromDate(transactionDate)
    }

    func updateDate(sender: UIDatePicker) {
        var chosenDate = sender.date
        let formatter = NSDateFormatter()
        formatter.dateStyle = .LongStyle
        self.dateInput.text = formatter.stringFromDate(chosenDate)
    }
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Follow up to DatePicker Question
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: NSNotificationQueue Question
  • Next by Date: Re: Collection Views Breaking
  • Previous by thread: Re: NSNotificationQueue Question
  • Next by thread: Re: Follow up to DatePicker Question
  • Index(es):
    • Date
    • Thread