Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 14, 2010, 07:40 AM   #1
mikezang
macrumors 6502a
 
Join Date: May 2010
Location: Tokyo, Japan
Can I set a couple year to DatePicker?

I am using DatePicker, and I want to know if I can set year to 2010, 2015 and so on, then the DatePicker can only be selected for year 2010 and 2015, is this possible?
__________________
iPad Mini 32GB, iPhone 4S 16GB, iPad1 32GB, Mac mini 2.53GHz 4GB 320GB, ThinkPad T60
MyApp: Market Event v1.9.2
mikezang is offline   0 Reply With Quote
Old Jul 14, 2010, 07:51 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
It might be possible with a custom (supplied by you) NSCalendar object that represents the dates you want. This seems very complex though. If you simply want to allow the user to pick from a set of years why not use a UIPickerView, specify the correct number of components and use the data source to only allow the values you want?

And before you ask, no I won't supply "sample code" for you to copy and paste and then claim as your own. The documentation should be more than enough to work this out.
robbieduncan is offline   0 Reply With Quote
Old Jul 14, 2010, 07:57 AM   #3
mikezang
Thread Starter
macrumors 6502a
 
Join Date: May 2010
Location: Tokyo, Japan
Now I just finished DatePicker, like you said, the next step is to make a PcikerView, I hope I can finish it by myself.

Thanks for your suggestion.
__________________
iPad Mini 32GB, iPhone 4S 16GB, iPad1 32GB, Mac mini 2.53GHz 4GB 320GB, ThinkPad T60
MyApp: Market Event v1.9.2
mikezang is offline   0 Reply With Quote
Old Jul 14, 2010, 11:28 AM   #4
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Why don't you use the minimumDate, maximumDate properties to make this work?
PhoneyDeveloper is offline   0 Reply With Quote
Old Jul 14, 2010, 11:34 AM   #5
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by PhoneyDeveloper View Post
Why don't you use the minimumDate, maximumDate properties to make this work?
Can you use those to set a non-contiguous date range? Seems that the OP wants to allow the user to choose a year of 2010 or 2015 but not 2011,2012, 2013 or 2014.
robbieduncan is offline   0 Reply With Quote
Old Jul 14, 2010, 03:12 PM   #6
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
I doubt it can be used for discontinuous date ranges. Is that really what OP wants? Sounds very oddball that the date picker would go from Dec 2010 to Jan 2015. There's probably a better UI for that.
PhoneyDeveloper is offline   0 Reply With Quote
Old Jul 14, 2010, 03:14 PM   #7
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by PhoneyDeveloper View Post
I doubt it can be used for discontinuous date ranges. Is that really what OP wants? Sounds very oddball that the date picker would go from Dec 2010 to Jan 2015. There's probably a better UI for that.
I can think of uses for that sort of thing. Say choosing individual dates from past Olympics/major sports championships...
robbieduncan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Can you set the airport extreme to have 3 networks? knux11 Mac Peripherals 7 Aug 20, 2010 04:52 PM
can I set Final Cut Express to auto render my video natatos Digital Video 2 Feb 16, 2009 09:12 PM
can I set Final Cut Express to auto render my video natatos Mac Basics and Help 0 Feb 16, 2009 03:02 PM
Can you set finder view options to default for a folder recursively? spaceballl OS X 0 Nov 16, 2007 05:49 PM
How can I set Core Duo Temp to autostart with OSX? 5150 Joker Mac Applications and Mac App Store 2 Nov 3, 2006 10:21 PM


All times are GMT -5. The time now is 09:42 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC