Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 14, 2010, 08: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, 08: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, 08: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, 12:28 PM   #4
PhoneyDeveloper
macrumors 68030
 
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, 12:34 PM   #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, 04:12 PM   #6
PhoneyDeveloper
macrumors 68030
 
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, 04: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

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad Mini: Is there going to be a new set of iPads released this year? Appl3FTW iPad 44 Apr 18, 2014 01:52 AM
DatePicker on UITableView's cell joak iPhone/iPad Programming 1 Mar 14, 2014 07:19 PM
Retina iPad Mini Display Production Levels Appear Set to Match Last Year's Model MacRumors iOS Blog Discussion 19 Aug 16, 2013 03:17 AM
Benfits storm kicks off - 17k a year couple don't fancy working niuniu Politics, Religion, Social Issues 69 Feb 11, 2013 12:31 PM
2012 year of the upgrades for me. couple questions... youngmac MacBook Air 4 Sep 21, 2012 11:08 AM

Forum Jump

All times are GMT -5. The time now is 02:18 AM.

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

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