I'm new to iOS development, learning bits and pieces. I've few more queries in continuation to another thread (iOS7: How does Apple make a navigation controller look like a uiactionsheet in the calendar app) on iOS 7 new event creation in default calendar that's shown when we click + on UINavigationBar (I assume).
Does anyone know how to create UIDatePicker so that its displayed/hidden when I click on Start/End date field? I saw one video where UIActionSheet was used in XCode 4.5, but in that user needs to click on Done etc button to hide it. In iOS 7 calendar its hidden when I click outside picker i.e. on Start Date field. I hope question is clear?
Kindly advise how to achieve this feature?
You can try and use the OCCalendarController, Its so simple and comfortable. Just download the zipped file and get all the files named after the prefix OC.
Of which in OCCalendarViewController.m you can make the necessary changes by adding Okay or Cancel buttons programmatically, yourself.
To call the calendar view in your main file use the lines,
//Here's where the magic happens
calVC = [[OCCalendarViewController alloc] initAtPoint:CGPointMake(150, 50) inView:self.view]; calVC.delegate = self; [self.view addSubview:calVC.view];
Also do include the following delegate to receive the date selection(if the user selects a date or date range)
- (void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
Finally you can also customize the arrow(which appears along with the calendar view) by using the code,
[OCCalendarViewController alloc] initAtPoint:insertPoint inView:self.view arrowPosition:OCArrowPositionRight]
Rest of the details can be found on the read me file. Try out yourself, It'll work like a charm.Cheers!