How to create new NSDate object from [myUIDatePicker date] ?
+1
A:
You don't need to create a new NSDate object, you can just use the one it gives you.
NSDate *chosenDate = myDatePicker.date;
jtbandes
2010-07-24 20:17:19
I want to get multiple dates from the picker, so I think I need to create multiple object and then insert those dates in the NSMutableArray.
sza
2010-07-24 20:18:55
You can just do `[array addObject:myDatePicker.date]` whenever you want to add a date.
jtbandes
2010-07-24 20:20:21
But somehow the object I inserted is out of scope. My guess is myDatePicker.date will not be returned the new NSDate object every time...
sza
2010-07-24 20:25:54
Yes, myDatePicker.date gives you the date it's set to. What do you mean it's out of scope? Can we see some code?
jtbandes
2010-07-24 20:32:36
You probably didn't initialize the array with enough capacity via `arrayWithCapacity`
iWasRobbed
2010-07-24 21:01:58
No, `arrayWithCapacity` is just a suggestion for the array, you can still add more objects.
jtbandes
2010-07-24 21:02:44
+1 for using dot syntax correctly.
Abizern
2010-08-03 20:21:12