How can I implement an iOS calendar picker similar to Hipmunk's? - ios

I'm working on a couple of iOS apps that require the user to select a calendar date, and while the built-in date picker widget is all right, I'd much prefer if users could choose days from a calendar grid, similar to how it works in Hipmunk's iOS app. In that app, users are shown an infinite scroll view showing a grid of days, with each cell showing the month and day. The days of the week are shown in a persistent (i.e. non-scrolling) banner.
In addition to simply showing a calendar, this control should allow dates to be highlighted/selected. Better still, users should be able to select a whole range of dates by tapping on the start and end days' cells, at which the whole range of days should be highlighted.
Any ideas?

It's an "infinite" UIScrollView with various other views inside of it. Apple provides a demo infinite UIScrollview in their StreetScroller project.
You'll be allocating and initializing views for the various things you wanted displayed on each day, and probably reusing views at the top for the dates (as one scrolls off to the left you change the date and move it over to the right, reusing it the way a UITableView traditionally does).
Selection is a matter of changing visible state of the objects that back your views.

Related

UITableviews inside UICollectionViewCells

I am trying to make a calendar like a google calendar in which each square has some text (events of the day).
For this, I think I must put a UITableView inside each UICollectionViewCell, but I am not accomplishing it. I don’t have a sample code because I don’t even know how to start solving this.
We don't need a UITableView, we can do it just by using UICollectionView.
But as you are new to this I suggest using a library JTAppleCalender.
With this library, you can create a calendar in iOS very easily and it is highly customizable.
List of features:
Range selection - select dates in a range. The design is entirely up
to you.
Boundary dates - limit the calendar date range
Week/month mode - show 1 row of weekdays. Or 2, 3 or 6
Custom cells - make your day-cells look however you want, with any
functionality you want
Custom calendar view - make your calendar look however you want, with
what ever functionality you want
First Day of week - pick anyday to be first day of the week
Horizontal or vertical mode
Ability to add month headers in varying sizes/styles of your liking
Ability to scroll to any month by simply using the date
Ability to design your calendar however you want. You want it, you
build it.
Github link: https://github.com/patchthecode/JTAppleCalendar
If you think that you don't want to use any library this answer may help you: Custom calender View

How to achieve calendar week view in swift iOS

How can I achieve week view of the calendar in my iOS app as shown below, ideally using Apple calendar components (if any) and also how can I retrieve the selected date.
I have tried using both FSCalender and CVCalender plugins, without much success, as each was missing one element or the other.
The answer is, you lay out a bunch of views and set their contents. Perhaps use a collection view for the horizontal days. Definitely use a table view for the times. There's nothing in the public SDK to do it all for you. You just put together a view hierarchy the normal way.

Imitating split view animation used in iOS Calendar app

I am currently experimenting with a calendar framework I found online which possesses most of the functionality I need. However, I would really like to add a feature similar to the animation in the iOS Calendar where when a date is tapped, the view splits at that location and the selected week moves to the top of the calendar. Its an intuitive way to display info about the selected day. I just need some suggestions as to how this can be achieved since I'm not super familiar with collection views.
The calendar is a grid collection view with months as different sections from what I understand. Is it possible to just stick a supplementary view anywhere in a collection view dynamically? Or maybe I should look into adjusting insets at a specific location? I'm really not sure what direction to take and could use some suggestions.
Here is sort of what I want to do but with a table view.

how many cells to commence with in a UICollectionView for a Calendar? (i.e. with infinite number of dates)

How many cells to commence with in a UICollectionView for a Calendar? That is my understanding is:
UICollectionView is good in that it only instantiates cells it
needs to display, but then
You still have to add the cells to the collection view
So what is best practice if say your view would only show 10 cells, but you had unlimited cells (e.g. scrolling up and down dates in a calendar). Do you enter say 100 cells for 100 dates (say 50 either side of the starting date of interest) and then manually keep track of when you get to one of these edges and then add more? This would kind of be ashame the UICollectionView framework couldn't keep track of this itself no?
So overall questions therefore (sorry) are really:
How many cells (dates) should you be creating in the collectionview. Should it be limited therefore to say 100
Is there no support in UICollectionView to automate adding more cells in for you for a Calendar type situation where dates are endless if the user wants to keep scrolling forward or backward
Any what is impact on the caching strategy for UICollectionViewLayoutAttributes too?
There is a project on Github with a calendar based on UICollectionView
https://www.cocoacontrols.com/controls/rsdayflow
I have used this component in a production project.
You can easily change it's appearance since every day is a uicollectionviewcell.
This project is based on https://github.com/evadne/DayFlow
that can be a good base to create what you need.
If you want to build your own calendar it can help you to find response to your questions: the code is easy to understand, and the implementation is in my opinion quite neat
It depends on how much is visualized in one screen. If it is one month i would have one month before and one month later. If it is only a day, one day before, one day later. Then use this infinite scrolling trick. There are many examples outside. I didn't read through the following link, but the pictures visualize the idea nicely:
Building a Infinitely-Scrolling Gallery With a UICollectionView

iOS - making a list of calendars

I have a problem : I would like to implement a list of calendars (as in Calendar app of ipad) where the user can view a list of months along with their days. The user can pick a particular day and jump to another view ("day" view).
I am trying to do it by using UICollectionView and putting some kind of calendar (like CKCalendar) inside the UICollectionViewCell.
Beside the fact that there is some problem in handling events from calendars, there is also a problem about loading of the view which can take even half a second for let's say 9 cells.
Any advice?

Resources